home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / mail / readers / mush-7.2 < prev    next >
Text File  |  1996-11-17  |  81KB  |  2,483 lines

  1. diff -rc --new-file orig/mush-7.2.5/Makefile mush-7.2.5/Makefile
  2. *** orig/mush-7.2.5/Makefile    Thu Jan  1 01:00:00 1970
  3. --- mush-7.2.5/Makefile    Wed Oct 27 17:22:17 1993
  4. ***************
  5. *** 0 ****
  6. --- 1,70 ----
  7. + # makefile.linux    (c) copyright 1991    (Dan Heller)
  8. + #
  9. + HDRS= mush.h config.h-dist strings.h bindings.h options.h version.h glob.h pop.h
  10. + SRCS= main.c init.c misc.c mail.c hdrs.c execute.c commands.c print.c dates.c \
  11. +       signals.c setopts.c msgs.c pick.c sort.c expr.c folders.c \
  12. +       loop.c viewopts.c curses.c curs_io.c bind.c file.c strings.c \
  13. +       lock.c macros.c options.c addrs.c malloc.c glob.c command2.c \
  14. +       pop.c pmush.c xcreat.c
  15. + OBJS= main.o init.o misc.o mail.o hdrs.o execute.o commands.o print.o file.o \
  16. +       signals.o setopts.o msgs.o pick.o sort.o expr.o strings.o \
  17. +       folders.o dates.o loop.o viewopts.o curses.o curs_io.o bind.o \
  18. +       lock.o macros.o options.o addrs.o malloc.o glob.o command2.o \
  19. +       pop.o pmush.o xcreat.o
  20. + HELP_FILES= README README-7.0 README-7.1 README-7.2.0 README-7.2.2 \
  21. +     README-7.2.4 mush.1 cmd_help Mushrc Mailrc Gnurc \
  22. +     sample.mushrc advanced.mushrc digestify
  23. + MAKES= makefile.bsd makefile.xenix makefile.sys.v makefile.hpux makefile.sun
  24. + # See the README for changes needed to compile under Ultrix.
  25. + # In particular, you may need -DSIGRET=void and/or -ltermcap.
  26. + CFLAGS= -O2 -Olimit 1024 -DBSD -D_BSD_SOURCE -DCURSES -DSIGRET=void
  27. + LDFLAGS= -s
  28. + LINTFLAGS= -bxah -Dlint -DCURSES -DBSD -D_BSD_SOURCE
  29. + LIBS= -lcurses -ltermcap
  30. + OTHERLIBS=
  31. + # Use some variant of this one if you #define MMDF in config.h
  32. + #OTHERLIBS=/usr/src/mmdf/lib/libmmdf.a
  33. + mush: $(OBJS)
  34. +     @echo loading...
  35. +     @cc $(LDFLAGS) $(OBJS) $(LIBS) $(OTHERLIBS) -o mush
  36. + $(OBJS): config.h mush.h
  37. + loop.o: version.h
  38. + tape:
  39. +     @tar cv $(MAKES) $(HDRS) $(SRCS) $(HELP_FILES)
  40. + tar:
  41. +     @tar fcv MUSH $(MAKES) $(HDRS) $(SRCS) $(HELP_FILES)
  42. + tarmail:
  43. +     tar fcv - $(MAKES) $(HDRS) $(SRCS) $(HELP_FILES) | \
  44. +     compress | btoa > mush.tarmail
  45. + lint:
  46. +     lint $(LINTFLAGS) $(SRCS)
  47. + clean:
  48. +     rm -f *.o core mush
  49. + BINDIR= /usr/bin
  50. + LIBDIR= /usr/lib
  51. + MRCDIR= /usr/lib
  52. + MANDIR= /usr/man/man1
  53. + MANEXT= 1
  54. + install: mush
  55. +     mv mush $(BINDIR)
  56. +     strip $(BINDIR)/mush
  57. +     chmod 0755 $(BINDIR)/mush
  58. +     cp mush.1 $(MANDIR)/mush.$(MANEXT)
  59. +     chmod 0644 $(MANDIR)/mush.$(MANEXT)
  60. +     cp cmd_help $(LIBDIR)
  61. +     chmod 0644 $(LIBDIR)/cmd_help
  62. +     cp Mushrc $(MRCDIR)/Mushrc
  63. +     chmod 0644 $(MRCDIR)/Mushrc
  64. diff -rc --new-file orig/mush-7.2.5/README-7.2.5+ mush-7.2.5/README-7.2.5+
  65. *** orig/mush-7.2.5/README-7.2.5+    Thu Jan  1 01:00:00 1970
  66. --- mush-7.2.5/README-7.2.5+    Wed Oct 27 18:14:32 1993
  67. ***************
  68. *** 0 ****
  69. --- 1,37 ----
  70. + This is release 7.2.5+ of the Mail User's Shell (mush).
  71. + This subservion was done on 931027
  72. + Sinze Z-mailer, the productified version of mush, has been introduced,
  73. + the authors of mush have not released (surprise, surprise) any update
  74. + to mush 7.2.5; here is a small one, perhaps it should be called 7.3.
  75. + The changes are:
  76. + * ported to Linux (this has been based on Linus Torvalds' own port).
  77. + * faster sorting on subject, by caching in core the subject line; this
  78. +   raises the working set, but the speedup is spectacular.
  79. + * sorting on To: or Newsgroups: line.
  80. + * pop3 support improved; the mailbox will not be checked (with consequent
  81. +   request for the password) at inconvenient times, like when composing
  82. +   a message to send, or if in mailbox mode. I actually think that the
  83. +   mailbox should not be checked automatically at all, but what the heck.
  84. + I have felt tempted to do more extensive surgery, like:
  85. + * completely removing tool mode, which just complicates the source, is
  86. +   not so elegant, and is obsolete by now.
  87. + * perhaps removing curses mode entirely too, as there are too many whacky
  88. +   compromises to shoehorn it in; it should be replaced, like tool mode,
  89. +   by a full screen frontend running as a separate process.
  90. + * cleaning up header line generation. Currently the header lines are rebuilt
  91. +   every time. Perhaps they ought to be cached, after all they are not
  92. +   that large. At the very least the ones on the current page in curses mode
  93. +   ought to be cached.
  94. + But these mods, while sensible, would require a new release number for mush
  95. + (say version 8), and I don't know who are the current maintainers...
  96. diff -rc --new-file orig/mush-7.2.5/cmd_help mush-7.2.5/cmd_help
  97. *** orig/mush-7.2.5/cmd_help    Fri May 17 02:28:46 1991
  98. --- mush-7.2.5/cmd_help    Wed Oct 27 18:08:16 1993
  99. ***************
  100. *** 430,441 ****
  101.   %%
  102.   
  103.   %sort%
  104. !       sort [-i] [-r|a|d|l|R|s|S]
  105.   
  106.     -i         ignore case in alphabetical sorts
  107.     -r         reverse order of next criteria
  108.   
  109.     -a         by author (alphabetical)
  110.     -d         according to date
  111.     -l         by length (size in characters, not lines)
  112.     -p         by priority (marks)
  113. --- 430,442 ----
  114.   %%
  115.   
  116.   %sort%
  117. !       sort [-i] [-r|a|t|d|l|R|s|S]
  118.   
  119.     -i         ignore case in alphabetical sorts
  120.     -r         reverse order of next criteria
  121.   
  122.     -a         by author (alphabetical)
  123. +   -t         by target (alphabetical)
  124.     -d         according to date
  125.     -l         by length (size in characters, not lines)
  126.     -p         by priority (marks)
  127. diff -rc --new-file orig/mush-7.2.5/config.h mush-7.2.5/config.h
  128. *** orig/mush-7.2.5/config.h    Thu Jan  1 01:00:00 1970
  129. --- mush-7.2.5/config.h    Sun Oct 17 15:31:38 1993
  130. ***************
  131. *** 0 ****
  132. --- 1,260 ----
  133. + /* config.h 1.1    (c) copyright 1986 (Dan Heller) */
  134. + /* Default names and locations for files */
  135. + #define MAILRC        ".mushrc"
  136. + #define ALTERNATE_RC    ".mailrc"
  137. + #define DEFAULT_RC    "/usr/lib/Mushrc"
  138. + #define ALT_DEF_RC    "/usr/lib/Mail.rc"
  139. + #define SIGNATURE    ".signature"
  140. + #define FORTUNE        "/usr/games/fortune"
  141. + #define COMMAND_HELP    "/usr/lib/cmd_help"
  142. + #ifdef SUNTOOL
  143. + #    define TOOL_HELP    "/usr/lib/tool_help"
  144. + #endif /* SUNTOOL */
  145. + #define ALTERNATE_HOME    "/tmp"       /* Path must be read/write to EVERYONE */
  146. + #define EDFILE      ".edXXXXXX"  /* file/pathname added to user's "home" */
  147. + #define LS_COMMAND    "ls"
  148. + #define LPR        "lpr"
  149. + #define DEF_PRINTER    "lp"
  150. + /* If your lpr command understands only -P or -d (or some other flag) then
  151. +  * define PRINTER_OPT to the appropriate value.  If you want to be able to
  152. +  * use either one, don't define this at all.  The defaults (when neither
  153. +  * -P nor -d is used on the mush "lpr" command line) are as noted here.
  154. +  * If your lpr requires that the option and the printer name be separate
  155. +  * arguments, include a trailing space in this definition.
  156. +  */
  157. + #ifdef SYSV
  158. + #define PRINTER_OPT    "-d"
  159. + #endif /* SYSV */
  160. + #ifdef BSD
  161. + #define PRINTER_OPT    "-P"
  162. + #endif /* BSD */
  163. + /* default settings for some variable strings */
  164. + #define DEF_PROMPT    "Msg %m of %t: "
  165. + #define DEF_PAGER    "more" /* set to "internal" to use internal pager */
  166. + #define DEF_SHELL    "sh"
  167. + #define DEF_EDITOR    "vi"
  168. + #define DEF_FOLDER    "~/Mail"        /* default Mail folder */
  169. + #define DEF_MBOX    "~/mbox"    /* default mbox */
  170. + #define DEF_INDENT_STR    "> "        /* indent included mail */
  171. + #define DEF_ESCAPE    "~"
  172. + #define DEF_HDR_FMT    "%25f %7d (%l/%c) \"%s\"" /* default hdr_format */
  173. + #define DEF_CURSES_HELP    \
  174. +     "display save mail reply next-msg back-msg screen-next screen-back"
  175. + /* Headers that will NOT be included when forwarding mail */
  176. + #define IGNORE_ON_FWD    "status,priority,return-receipt-to"
  177. + #define    MAXMSGS    1000        /* Maximum number of messages we can read */
  178. + #define HDRSIZ    (2*BUFSIZ)    /* This should not be < BUFSIZ! */
  179. + /*
  180. +  * Define INTERNAL_MALLOC and recompile if you have trouble with mush
  181. +  * core-dumping due to malloc/free errors.  Also, if you run a System 5
  182. +  * variant, you might notice a performance improvement if you define this
  183. +  * variable.  It uses the malloc distributed by Larry Wall for perl v2.
  184. +  */
  185. + /* #define INTERNAL_MALLOC /**/
  186. + /*
  187. +  * Define TIMEZONE if your system has neither the SysV external variable
  188. +  * tzname nor the BSD timezone() function.  The example below is for
  189. +  * Gould BSD4.3 systems; others should define it as a string, e.g. "PST"
  190. +  * If TIMEZONE is defined, DAYLITETZ can also be defined, e.g. "PDT"
  191. +  *
  192. +  * Define USA if you are using US/NorthAmerican time zone abbreviations.
  193. +  * If USA is not defined, dates in outgoing mail will include timezones
  194. +  * specified as offsets from GMT, e.g. Pacific Standard Time is -0800.
  195. +  */
  196. + /* #define TIMEZONE T->tm_zone /**/
  197. + /* #define USA /**/
  198. + /* mail delivery system macros and defines... */
  199. + /*
  200. +  * For POP3_SUPPORT, define this.  Mush will act as a POP-3 client,
  201. +  * periodically calling the server on the machine described by the
  202. +  * environment variable MAILHOST to pick up new mail.
  203. +  */
  204. + #define POP3_SUPPORT /**/
  205. + #ifdef POP3_SUPPORT
  206. + #define HOMEMAIL
  207. + #endif /* POP3_SUPPORT */
  208. + /*
  209. +  * If you are using MMDF, define MMDF here.
  210. +  */
  211. + /* #define MMDF /**/
  212. + #if defined(M_UNIX) && defined(M_XENIX)
  213. + #define MMDF
  214. + /* #define M_EXECMAIL    /* Define if you haven't fixed submit permissions */
  215. + #endif /* M_UNIX && M_XENIX */
  216. + #ifdef MMDF
  217. + /*
  218. +  * If MMDF delivers mail the user's home directory, define HOMEMAIL.
  219. +  * Also check the definition of the delivery file name MAILFILE, below.
  220. +  */
  221. + /* #define HOMEMAIL /**/
  222. + #ifdef M_EXECMAIL
  223. + #define MAIL_DELIVERY    "/usr/lib/mail/execmail"
  224. + # define VERBOSE_ARG    "-v"
  225. + # define METOO_ARG    "-m"
  226. + #else /* M_EXECMAIL */
  227. + #define MAIL_DELIVERY    "exec /usr/mmdf/bin/submit -mlnr"
  228. + #define VERBOSE_ARG    "Ww"
  229. + #define MTA_EXIT    9    /* exit status for successful submit */
  230. + #endif /* M_EXECMAIL */
  231. + #else /* MMDF */
  232. + /*
  233. +  * If you are not using MMDF, check these definitions.
  234. +  */
  235. + #define MAIL_DELIVERY    "/usr/lib/sendmail -i" /* "-i" works like "-oi" */
  236. + #define VERBOSE_ARG    "-v"    /* undef if none exists */
  237. + #define METOO_ARG    "-m"    /* man sendmail for more info. */
  238. + #define MTA_EXIT    0    /* exit status for successful mail delivery */
  239. + #endif /* MMDF */
  240. + /* If your mail transfer agent uses something *besides* "From " to separate
  241. +  * adjacent messages in a folder, define MSG_SEPARATOR to be this string.
  242. +  * If that string is 4 ^A's, then the string would be "\001\001\001\001".
  243. +  * With the exception of MMDF, below, you should OMIT a trailing newline
  244. +  * from the setting of MSG_SEPARATOR.
  245. +  * If you don't know what any of this means, leave it alone.
  246. +  */
  247. + /* #define MSG_SEPARATOR "From " /**/
  248. + #ifdef MMDF
  249. + /*
  250. +  * These values should be identical (respectively) to the contents of
  251. +  * delim1 and delim2 in MMDFSRC/conf/yoursite/conf.c (sans newline).
  252. +  */
  253. + #define MSG_SEPARATOR    "\001\001\001\001\n"
  254. + #define END_MSG_SEP    "\001\001\001\001\n"
  255. + /*
  256. +  * You only need to define LCKDFLDIR if you have MMDF configured to use the
  257. +  * locking routines in lib/util/lk_lock.c (ie., link(2)-based locking).
  258. +  * Most of you WILL NOT need this, since you probably use one of the more
  259. +  * sophisticated locking modules provided with MMDF.  Remember to alter the
  260. +  * Makefile so as to access the MMDF library at the link step.
  261. +  */
  262. + /* #define LCKDFLDIR    "/usr/spool/mmdf/lockfiles" /* (for example) */
  263. + #else /* !MMDF */
  264. + #ifdef M_XENIX
  265. + #define DOT_LOCK    /* DOT_LOCK should be used for SCO Xenix */
  266. + #endif /* M_XENIX */
  267. + #endif /* MMDF */
  268. + #ifdef HOMEMAIL
  269. + #define MAILFILE    ".mailbox"    /* or whatever */
  270. + #else /* HOMEMAIL */
  271. + #ifndef MAILDIR
  272. + #if defined(SYSV) && !defined(SVR4)
  273. + #define MAILDIR        "/usr/mail"
  274. + #else /* BSD || SVR4 */
  275. + #define MAILDIR        "/usr/spool/mail"
  276. + #endif /* SYSV && !SVR4 */
  277. + #endif /* MAILDIR */
  278. + #endif /* HOMEMAIL */
  279. + /* If your mailer does not understand commas between addresses, you should
  280. +  * define NO_COMMAS.  This includes pre-3.0 smail and default MTAs used on
  281. +  * xenix, and sys-v systems.
  282. +  * This does NOT apply to MMDF or sendmail, in most cases.  SunOS 4.1 as
  283. +  * shipped needs this, but note that if you are allowing mush to default
  284. +  * to SUN_4_1 (see the end of this file) you won't get this.
  285. +  */
  286. + #ifdef SUN_4_1        /* SunOS 4.1 has warped sendmail.cf */
  287. + #define NO_COMMAS /**/
  288. + #endif /* SUN_4_1 */
  289. + /*
  290. +  * Most RFC822-compliant mailers (sendmail) will add the headers From:
  291. +  * and Date: on outgoing mail.  If the user or UA sends these headers,
  292. +  * such MTAs will generally use the headers as the user or UA set them.
  293. +  * Mailers that are not RFC822-compliant sometimes fail to add these
  294. +  * headers at all, so the UA must supply them.  Mush normally does so.
  295. +  *
  296. +  * However, there are certain MTAs which will insist on adding new From:
  297. +  * and Date: headers.  These "picky mailers" may remove the user or UA 
  298. +  * From: and Date: headers, or they may leave them but insert a leading
  299. +  * '>', which makes the headers very ugly and redundant or contradictory.
  300. +  * PICKY_MAILER prevents mush from adding From: or Date:, so the MTA can.
  301. +  *
  302. +  * Many RFC822-compliant mailers are "picky", including certain sendmail
  303. +  * configurations.  It is advisable to set PICKY_MAILER *UNLESS* your MTA
  304. +  * is known not to be RFC822 compiant (xenix, older sys-v) or can be
  305. +  * counted on to pass through user-defined headers without modification.
  306. +  */
  307. + /* #define PICKY_MAILER /**/
  308. + /* If your system supports the vprintf() functions, True for sys-v and
  309. +  * later sun versions (3.0+ ?).  Typically not true for BSD systems, but
  310. +  * that will probably change in the future.
  311. +  */
  312. + #if defined(__linux__) || defined(SYSV) || defined(sun)
  313. + #define VPRINTF
  314. + #endif /* __linux__ || SYSV || sun */
  315. + /* If your system uses the getwd() system call (as opposed to getcwd()),
  316. +  * and your system is not a BSD system (e.g. MIPS), define GETWD below.
  317. +  */
  318. + /* #define GETWD    /**/
  319. + /* If your system has the BSD-style directory routines (opendir/readdir),
  320. +  * define DIRECTORY.  This happens automatically in glob.h for BSD.
  321. +  */
  322. + #if defined(SVR4) || defined(__linux__)
  323. + #define DIRECTORY
  324. + #endif /* SVR4 || __linux__ */
  325. + /* If your system has the POSIX "utimbuf" structure for utime(2),
  326. +  * define POSIX_UTIME.  You may have to change <sys/utime.h> to <utime.h>
  327. +  * in mush.h.
  328. +  */
  329. + #if defined(__linux__) || (defined(SVR4) && !defined(sun))
  330. + #define POSIX_UTIME
  331. + #endif /* __linux__ || (SVR4 && !sun) */
  332. + /* The remainder of this file attempt to automatically supply some sanity.
  333. +  * You shouldn't need to change this part unless your system is really odd.
  334. +  */
  335. + #ifdef BSD
  336. + #    undef SYSV /* Sorry, can't do both BSD and SYSV */
  337. + #    undef SVR4
  338. + #    undef SVR3
  339. + #    undef SVR2
  340. + #endif /* BSD */
  341. + #if defined(SUNTOOL) || defined(SUN_3_5) || defined(SUN_4_0) || defined(SUN_4_1)
  342. + #if !defined(BSD) && !defined(SYSV)
  343. + #    define BSD /* default to BSD */
  344. + #endif /* !BSD && !SYSV */
  345. + #if !defined(SUN_3_5) && !defined(SUN_4_0)
  346. + #    ifndef SUN_4_1
  347. + #        define SUN_4_1 /* default to sun 4.1 */
  348. + #    endif /* SUN_4_1 */
  349. + #    define SUN_4_0 /* 4.0 stuff needed too */
  350. + #endif /* !SUN_3_5 && !SUN_4_0 */
  351. + #ifdef SUN_4_0
  352. + #    undef SUN_3_5
  353. + #    undef SIGRET
  354. + #    define SIGRET void
  355. + #endif /* SUN_4_0 */
  356. + #endif /* SUNTOOL || SUN_3_5 || SUN_4_0 || SUN_4_1 */
  357. + #ifdef SVR4
  358. + #    undef SVR3
  359. + #    undef SYSV
  360. + #    define SYSV
  361. + #else
  362. + #ifdef SYSV
  363. + #    undef SVR3
  364. + #    ifndef SVR2
  365. + #        define SVR3
  366. + #    endif /* SVR2 */
  367. + #endif /* SYSV */
  368. + #endif /* SVR4 */
  369. + #ifdef SVR3
  370. + #    undef SYSV
  371. + #    define SYSV
  372. + #endif /* SVR3 */
  373. diff -rc --new-file orig/mush-7.2.5/config.h-linux mush-7.2.5/config.h-linux
  374. *** orig/mush-7.2.5/config.h-linux    Thu Jan  1 01:00:00 1970
  375. --- mush-7.2.5/config.h-linux    Sun Oct 17 15:31:29 1993
  376. ***************
  377. *** 0 ****
  378. --- 1,260 ----
  379. + /* config.h 1.1    (c) copyright 1986 (Dan Heller) */
  380. + /* Default names and locations for files */
  381. + #define MAILRC        ".mushrc"
  382. + #define ALTERNATE_RC    ".mailrc"
  383. + #define DEFAULT_RC    "/usr/lib/Mushrc"
  384. + #define ALT_DEF_RC    "/usr/lib/Mail.rc"
  385. + #define SIGNATURE    ".signature"
  386. + #define FORTUNE        "/usr/games/fortune"
  387. + #define COMMAND_HELP    "/usr/lib/cmd_help"
  388. + #ifdef SUNTOOL
  389. + #    define TOOL_HELP    "/usr/lib/tool_help"
  390. + #endif /* SUNTOOL */
  391. + #define ALTERNATE_HOME    "/tmp"       /* Path must be read/write to EVERYONE */
  392. + #define EDFILE      ".edXXXXXX"  /* file/pathname added to user's "home" */
  393. + #define LS_COMMAND    "ls"
  394. + #define LPR        "lpr"
  395. + #define DEF_PRINTER    "lp"
  396. + /* If your lpr command understands only -P or -d (or some other flag) then
  397. +  * define PRINTER_OPT to the appropriate value.  If you want to be able to
  398. +  * use either one, don't define this at all.  The defaults (when neither
  399. +  * -P nor -d is used on the mush "lpr" command line) are as noted here.
  400. +  * If your lpr requires that the option and the printer name be separate
  401. +  * arguments, include a trailing space in this definition.
  402. +  */
  403. + #ifdef SYSV
  404. + #define PRINTER_OPT    "-d"
  405. + #endif /* SYSV */
  406. + #ifdef BSD
  407. + #define PRINTER_OPT    "-P"
  408. + #endif /* BSD */
  409. + /* default settings for some variable strings */
  410. + #define DEF_PROMPT    "Msg %m of %t: "
  411. + #define DEF_PAGER    "more" /* set to "internal" to use internal pager */
  412. + #define DEF_SHELL    "sh"
  413. + #define DEF_EDITOR    "vi"
  414. + #define DEF_FOLDER    "~/Mail"        /* default Mail folder */
  415. + #define DEF_MBOX    "~/mbox"    /* default mbox */
  416. + #define DEF_INDENT_STR    "> "        /* indent included mail */
  417. + #define DEF_ESCAPE    "~"
  418. + #define DEF_HDR_FMT    "%25f %7d (%l/%c) \"%s\"" /* default hdr_format */
  419. + #define DEF_CURSES_HELP    \
  420. +     "display save mail reply next-msg back-msg screen-next screen-back"
  421. + /* Headers that will NOT be included when forwarding mail */
  422. + #define IGNORE_ON_FWD    "status,priority,return-receipt-to"
  423. + #define    MAXMSGS    1000        /* Maximum number of messages we can read */
  424. + #define HDRSIZ    (2*BUFSIZ)    /* This should not be < BUFSIZ! */
  425. + /*
  426. +  * Define INTERNAL_MALLOC and recompile if you have trouble with mush
  427. +  * core-dumping due to malloc/free errors.  Also, if you run a System 5
  428. +  * variant, you might notice a performance improvement if you define this
  429. +  * variable.  It uses the malloc distributed by Larry Wall for perl v2.
  430. +  */
  431. + /* #define INTERNAL_MALLOC /**/
  432. + /*
  433. +  * Define TIMEZONE if your system has neither the SysV external variable
  434. +  * tzname nor the BSD timezone() function.  The example below is for
  435. +  * Gould BSD4.3 systems; others should define it as a string, e.g. "PST"
  436. +  * If TIMEZONE is defined, DAYLITETZ can also be defined, e.g. "PDT"
  437. +  *
  438. +  * Define USA if you are using US/NorthAmerican time zone abbreviations.
  439. +  * If USA is not defined, dates in outgoing mail will include timezones
  440. +  * specified as offsets from GMT, e.g. Pacific Standard Time is -0800.
  441. +  */
  442. + /* #define TIMEZONE T->tm_zone /**/
  443. + /* #define USA /**/
  444. + /* mail delivery system macros and defines... */
  445. + /*
  446. +  * For POP3_SUPPORT, define this.  Mush will act as a POP-3 client,
  447. +  * periodically calling the server on the machine described by the
  448. +  * environment variable MAILHOST to pick up new mail.
  449. +  */
  450. + #define POP3_SUPPORT /**/
  451. + #ifdef POP3_SUPPORT
  452. + #define HOMEMAIL
  453. + #endif /* POP3_SUPPORT */
  454. + /*
  455. +  * If you are using MMDF, define MMDF here.
  456. +  */
  457. + /* #define MMDF /**/
  458. + #if defined(M_UNIX) && defined(M_XENIX)
  459. + #define MMDF
  460. + /* #define M_EXECMAIL    /* Define if you haven't fixed submit permissions */
  461. + #endif /* M_UNIX && M_XENIX */
  462. + #ifdef MMDF
  463. + /*
  464. +  * If MMDF delivers mail the user's home directory, define HOMEMAIL.
  465. +  * Also check the definition of the delivery file name MAILFILE, below.
  466. +  */
  467. + /* #define HOMEMAIL /**/
  468. + #ifdef M_EXECMAIL
  469. + #define MAIL_DELIVERY    "/usr/lib/mail/execmail"
  470. + # define VERBOSE_ARG    "-v"
  471. + # define METOO_ARG    "-m"
  472. + #else /* M_EXECMAIL */
  473. + #define MAIL_DELIVERY    "exec /usr/mmdf/bin/submit -mlnr"
  474. + #define VERBOSE_ARG    "Ww"
  475. + #define MTA_EXIT    9    /* exit status for successful submit */
  476. + #endif /* M_EXECMAIL */
  477. + #else /* MMDF */
  478. + /*
  479. +  * If you are not using MMDF, check these definitions.
  480. +  */
  481. + #define MAIL_DELIVERY    "/usr/lib/sendmail -i" /* "-i" works like "-oi" */
  482. + #define VERBOSE_ARG    "-v"    /* undef if none exists */
  483. + #define METOO_ARG    "-m"    /* man sendmail for more info. */
  484. + #define MTA_EXIT    0    /* exit status for successful mail delivery */
  485. + #endif /* MMDF */
  486. + /* If your mail transfer agent uses something *besides* "From " to separate
  487. +  * adjacent messages in a folder, define MSG_SEPARATOR to be this string.
  488. +  * If that string is 4 ^A's, then the string would be "\001\001\001\001".
  489. +  * With the exception of MMDF, below, you should OMIT a trailing newline
  490. +  * from the setting of MSG_SEPARATOR.
  491. +  * If you don't know what any of this means, leave it alone.
  492. +  */
  493. + /* #define MSG_SEPARATOR "From " /**/
  494. + #ifdef MMDF
  495. + /*
  496. +  * These values should be identical (respectively) to the contents of
  497. +  * delim1 and delim2 in MMDFSRC/conf/yoursite/conf.c (sans newline).
  498. +  */
  499. + #define MSG_SEPARATOR    "\001\001\001\001\n"
  500. + #define END_MSG_SEP    "\001\001\001\001\n"
  501. + /*
  502. +  * You only need to define LCKDFLDIR if you have MMDF configured to use the
  503. +  * locking routines in lib/util/lk_lock.c (ie., link(2)-based locking).
  504. +  * Most of you WILL NOT need this, since you probably use one of the more
  505. +  * sophisticated locking modules provided with MMDF.  Remember to alter the
  506. +  * Makefile so as to access the MMDF library at the link step.
  507. +  */
  508. + /* #define LCKDFLDIR    "/usr/spool/mmdf/lockfiles" /* (for example) */
  509. + #else /* !MMDF */
  510. + #ifdef M_XENIX
  511. + #define DOT_LOCK    /* DOT_LOCK should be used for SCO Xenix */
  512. + #endif /* M_XENIX */
  513. + #endif /* MMDF */
  514. + #ifdef HOMEMAIL
  515. + #define MAILFILE    ".mailbox"    /* or whatever */
  516. + #else /* HOMEMAIL */
  517. + #ifndef MAILDIR
  518. + #if defined(SYSV) && !defined(SVR4)
  519. + #define MAILDIR        "/usr/mail"
  520. + #else /* BSD || SVR4 */
  521. + #define MAILDIR        "/usr/spool/mail"
  522. + #endif /* SYSV && !SVR4 */
  523. + #endif /* MAILDIR */
  524. + #endif /* HOMEMAIL */
  525. + /* If your mailer does not understand commas between addresses, you should
  526. +  * define NO_COMMAS.  This includes pre-3.0 smail and default MTAs used on
  527. +  * xenix, and sys-v systems.
  528. +  * This does NOT apply to MMDF or sendmail, in most cases.  SunOS 4.1 as
  529. +  * shipped needs this, but note that if you are allowing mush to default
  530. +  * to SUN_4_1 (see the end of this file) you won't get this.
  531. +  */
  532. + #ifdef SUN_4_1        /* SunOS 4.1 has warped sendmail.cf */
  533. + #define NO_COMMAS /**/
  534. + #endif /* SUN_4_1 */
  535. + /*
  536. +  * Most RFC822-compliant mailers (sendmail) will add the headers From:
  537. +  * and Date: on outgoing mail.  If the user or UA sends these headers,
  538. +  * such MTAs will generally use the headers as the user or UA set them.
  539. +  * Mailers that are not RFC822-compliant sometimes fail to add these
  540. +  * headers at all, so the UA must supply them.  Mush normally does so.
  541. +  *
  542. +  * However, there are certain MTAs which will insist on adding new From:
  543. +  * and Date: headers.  These "picky mailers" may remove the user or UA 
  544. +  * From: and Date: headers, or they may leave them but insert a leading
  545. +  * '>', which makes the headers very ugly and redundant or contradictory.
  546. +  * PICKY_MAILER prevents mush from adding From: or Date:, so the MTA can.
  547. +  *
  548. +  * Many RFC822-compliant mailers are "picky", including certain sendmail
  549. +  * configurations.  It is advisable to set PICKY_MAILER *UNLESS* your MTA
  550. +  * is known not to be RFC822 compiant (xenix, older sys-v) or can be
  551. +  * counted on to pass through user-defined headers without modification.
  552. +  */
  553. + /* #define PICKY_MAILER /**/
  554. + /* If your system supports the vprintf() functions, True for sys-v and
  555. +  * later sun versions (3.0+ ?).  Typically not true for BSD systems, but
  556. +  * that will probably change in the future.
  557. +  */
  558. + #if defined(__linux__) || defined(SYSV) || defined(sun)
  559. + #define VPRINTF
  560. + #endif /* __linux__ || SYSV || sun */
  561. + /* If your system uses the getwd() system call (as opposed to getcwd()),
  562. +  * and your system is not a BSD system (e.g. MIPS), define GETWD below.
  563. +  */
  564. + /* #define GETWD    /**/
  565. + /* If your system has the BSD-style directory routines (opendir/readdir),
  566. +  * define DIRECTORY.  This happens automatically in glob.h for BSD.
  567. +  */
  568. + #if defined(SVR4) || defined(__linux__)
  569. + #define DIRECTORY
  570. + #endif /* SVR4 || __linux__ */
  571. + /* If your system has the POSIX "utimbuf" structure for utime(2),
  572. +  * define POSIX_UTIME.  You may have to change <sys/utime.h> to <utime.h>
  573. +  * in mush.h.
  574. +  */
  575. + #if defined(__linux__) || (defined(SVR4) && !defined(sun))
  576. + #define POSIX_UTIME
  577. + #endif /* __linux__ || (SVR4 && !sun) */
  578. + /* The remainder of this file attempt to automatically supply some sanity.
  579. +  * You shouldn't need to change this part unless your system is really odd.
  580. +  */
  581. + #ifdef BSD
  582. + #    undef SYSV /* Sorry, can't do both BSD and SYSV */
  583. + #    undef SVR4
  584. + #    undef SVR3
  585. + #    undef SVR2
  586. + #endif /* BSD */
  587. + #if defined(SUNTOOL) || defined(SUN_3_5) || defined(SUN_4_0) || defined(SUN_4_1)
  588. + #if !defined(BSD) && !defined(SYSV)
  589. + #    define BSD /* default to BSD */
  590. + #endif /* !BSD && !SYSV */
  591. + #if !defined(SUN_3_5) && !defined(SUN_4_0)
  592. + #    ifndef SUN_4_1
  593. + #        define SUN_4_1 /* default to sun 4.1 */
  594. + #    endif /* SUN_4_1 */
  595. + #    define SUN_4_0 /* 4.0 stuff needed too */
  596. + #endif /* !SUN_3_5 && !SUN_4_0 */
  597. + #ifdef SUN_4_0
  598. + #    undef SUN_3_5
  599. + #    undef SIGRET
  600. + #    define SIGRET void
  601. + #endif /* SUN_4_0 */
  602. + #endif /* SUNTOOL || SUN_3_5 || SUN_4_0 || SUN_4_1 */
  603. + #ifdef SVR4
  604. + #    undef SVR3
  605. + #    undef SYSV
  606. + #    define SYSV
  607. + #else
  608. + #ifdef SYSV
  609. + #    undef SVR3
  610. + #    ifndef SVR2
  611. + #        define SVR3
  612. + #    endif /* SVR2 */
  613. + #endif /* SYSV */
  614. + #endif /* SVR4 */
  615. + #ifdef SVR3
  616. + #    undef SYSV
  617. + #    define SYSV
  618. + #endif /* SVR3 */
  619. diff -rc --new-file orig/mush-7.2.5/config.h-svr4 mush-7.2.5/config.h-svr4
  620. *** orig/mush-7.2.5/config.h-svr4    Thu Jan  1 01:00:00 1970
  621. --- mush-7.2.5/config.h-svr4    Sat Sep 11 20:36:53 1993
  622. ***************
  623. *** 0 ****
  624. --- 1,176 ----
  625. + /* config.h 1.1    (c) copyright 1986 (Dan Heller) */
  626. + /* Default names and locations for files */
  627. + #define MAILRC        ".mushrc"
  628. + #define ALTERNATE_RC    ".mailrc"
  629. + #define DEFAULT_RC    "/usr/local/lib/Mushrc"
  630. + #define ALT_DEF_RC    "/usr/local/lib/Mail.rc"
  631. + #define SIGNATURE    ".signature"
  632. + #define FORTUNE        "/usr/local/games/fortune"
  633. + #define COMMAND_HELP    "/usr/local/lib/cmd_help"
  634. + #ifdef SUNTOOL
  635. + #    define TOOL_HELP    "/usr/local/lib/tool_help"
  636. + #endif /* SUNTOOL */
  637. + #define ALTERNATE_HOME    "/tmp"       /* Path must be read/write to EVERYONE */
  638. + #define EDFILE      ".edXXXXXX"  /* file/pathname added to user's "home" */
  639. + #define LS_COMMAND    "ls"
  640. + #define LPR        "lp"
  641. + #define DEF_PRINTER    "lp"
  642. + /* If your lpr command understands only -P or -d (or some other flag) then
  643. +  * define PRINTER_OPT to the appropriate value.  If you want to be able to
  644. +  * use either one, don't define this at all.  The defaults (when neither
  645. +  * -P nor -d is used on the mush "lpr" command line) are as noted here.
  646. +  * If your lpr requires that the option and the printer name be separate
  647. +  * arguments, include a trailing space in this definition.
  648. +  */
  649. + #ifdef SYSV
  650. + #define PRINTER_OPT    "-d"
  651. + #endif /* SYSV */
  652. + #ifdef BSD
  653. + #define PRINTER_OPT    "-P"
  654. + #endif /* BSD */
  655. + /* default settings for some variable strings */
  656. + #define DEF_PROMPT    "%m/%t: "
  657. + #define DEF_PAGER    "internal" /* set to "internal" to use internal pager */
  658. + #define DEF_SHELL    "$SHELL"
  659. + #define DEF_EDITOR    "$EDITOR"
  660. + #define DEF_FOLDER    "~/Mail"        /* default Mail folder */
  661. + #define DEF_MBOX    "~/mbox"    /* default mbox */
  662. + #define DEF_INDENT_STR    "  "        /* indent included mail */
  663. + #define DEF_ESCAPE    "~"
  664. + #define DEF_HDR_FMT    "%16n %13d %-4l %34s" /* default hdr_format */
  665. + #define DEF_CURSES_HELP    \
  666. +     "display save mail reply next-msg back-msg screen-next screen-back"
  667. + /* Headers that will NOT be included when forwarding mail */
  668. + #define IGNORE_ON_FWD    "status,priority,return-receipt-to"
  669. + #define    MAXMSGS    1000        /* Maximum number of messages we can read */
  670. + #define HDRSIZ    (2*BUFSIZ)    /* This should not be < BUFSIZ! */
  671. + /*
  672. +  * Define INTERNAL_MALLOC and recompile if you have trouble with mush
  673. +  * core-dumping due to malloc/free errors.  Also, if you run a System 5
  674. +  * variant, you might notice a performance improvement if you define this
  675. +  * variable.  It uses the malloc distributed by Larry Wall for perl v2.
  676. +  */
  677. + /* #define INTERNAL_MALLOC /**/
  678. + /*
  679. +  * Define TIMEZONE if your system has neither the SysV external variable
  680. +  * tzname nor the BSD timezone() function.  The example below is for
  681. +  * Gould BSD4.3 systems; others should define it as a string, e.g. "PST"
  682. +  * If TIMEZONE is defined, DAYLITETZ can also be defined, e.g. "PDT"
  683. +  *
  684. +  * Define USA if you are using US/NorthAmerican time zone abbreviations.
  685. +  * If USA is not defined, dates in outgoing mail will include timezones
  686. +  * specified as offsets from GMT, e.g. Pacific Standard Time is -0800.
  687. +  */
  688. + /* #define TIMEZONE T->tm_zone /**/
  689. + /* #define USA /**/
  690. + /* mail delivery system macros and defines... */
  691. + /*
  692. +  * If you are using MMDF, define MMDF here.
  693. +  */
  694. + /* #define MMDF /**/
  695. + #if defined(M_UNIX) && defined(M_XENIX)
  696. + #define MMDF
  697. + /* #define M_EXECMAIL    /* Define if you haven't fixed submit permissions */
  698. + #endif /* M_UNIX && M_XENIX */
  699. + #ifdef MMDF
  700. + /*
  701. +  * If MMDF delivers mail the user's home directory, define HOMEMAIL.
  702. +  * Also check the definition of the delivery file name MAILFILE, below.
  703. +  */
  704. + /* #define HOMEMAIL /**/
  705. + #ifdef M_EXECMAIL
  706. + #define MAIL_DELIVERY    "/usr/lib/mail/execmail"
  707. + # define VERBOSE_ARG    "-v"
  708. + # define METOO_ARG    "-m"
  709. + #else /* M_EXECMAIL */
  710. + #define MAIL_DELIVERY    "exec /usr/mmdf/bin/submit -mlnr"
  711. + #define VERBOSE_ARG    "Ww"
  712. + #define MTA_EXIT    9    /* exit status for successful submit */
  713. + #endif /* M_EXECMAIL */
  714. + #else /* MMDF */
  715. + /*
  716. +  * If you are not using MMDF, check these definitions.
  717. +  */
  718. + #define MAIL_DELIVERY    "/usr/lib/sendmail -i" /* "-i" works like "-oi" */
  719. + #define VERBOSE_ARG    "-v"    /* undef if none exists */
  720. + #define METOO_ARG    "-m"    /* man sendmail for more info. */
  721. + #define MTA_EXIT    0    /* exit status for successful mail delivery */
  722. + #endif /* MMDF */
  723. + /* If your mail transfer agent uses something *besides* "From " to separate
  724. +  * adjacent messages in a folder, define MSG_SEPARATOR to be this string.
  725. +  * If that string is 4 ^A's, then the string would be "\001\001\001\001".
  726. +  * With the exception of MMDF, below, you should OMIT a trailing newline
  727. +  * from the setting of MSG_SEPARATOR.
  728. +  * If you don't know what any of this means, leave it alone.
  729. +  */
  730. + /* #define MSG_SEPARATOR "From " /**/
  731. + #ifdef MMDF
  732. + /*
  733. +  * These values should be identical (respectively) to the contents of
  734. +  * delim1 and delim2 in MMDFSRC/conf/yoursite/conf.c (sans newline).
  735. +  */
  736. + #define MSG_SEPARATOR    "\001\001\001\001\n"
  737. + #define END_MSG_SEP    "\001\001\001\001\n"
  738. + /*
  739. +  * You only need to define LCKDFLDIR if you have MMDF configured to use the
  740. +  * locking routines in lib/util/lk_lock.c (ie., link(2)-based locking).
  741. +  * Most of you WILL NOT need this, since you probably use one of the more
  742. +  * sophisticated locking modules provided with MMDF.  Remember to alter the
  743. +  * Makefile so as to access the MMDF library at the link step.
  744. +  */
  745. + /* #define LCKDFLDIR    "/usr/spool/mmdf/lockfiles" /* (for example) */
  746. + #else /* !MMDF */
  747. + #ifdef M_XENIX
  748. + #define DOT_LOCK    /* DOT_LOCK should be used for SCO Xenix */
  749. + #endif /* M_XENIX */
  750. + #endif /* MMDF */
  751. + /* If your mailer does not understand commas between addresses, you should
  752. +  * define NO_COMMAS.  This includes pre-3.0 smail and default MTAs used on
  753. +  * xenix, and sys-v systems.
  754. +  * This does NOT apply to MMDF or sendmail, in most cases.
  755. +  */
  756. + /* #ifdef SUN_4_1        /* SunOS 4.1 has warped sendmail.cf */
  757. + #define NO_COMMAS /**/
  758. + /* #endif /* SUN_4_1 */
  759. + /*
  760. +  * Most RFC822 compliant mailers (sendmail) will add the headers From:
  761. +  * and Date: on outgoing mail.  If the user or UA sends these headers,
  762. +  * most MTAs will not append them automatically.  However, there are
  763. +  * certain MTAs which will not allow this -- these "picky mailers" will
  764. +  * precede such headers with a '>' and make the headers very ugly and
  765. +  * somewhat redundant or contradictory.  It is advisable to set this
  766. +  * *UNLESS* your MTA is not RFC822 compiant -- therefore you should NOT
  767. +  * set this (xenix, sys-v).
  768. +  */
  769. + /* #define PICKY_MAILER /**/
  770. + /* If your system supports the vprintf() functions, True for sys-v and
  771. +  * later sun versions (3.0+ ?).  Typically not true for BSD systems, but
  772. +  * that will probably change in the future.
  773. +  */
  774. + #if defined(SYSV) || defined(sun)
  775. + #define VPRINTF
  776. + #endif /* SYSV || sun */
  777. + /* If your system uses the getwd() system call (as opposed to getcwd()),
  778. +  * and your system is not a BSD system (e.g. MIPS), define GETWD below.
  779. +  */
  780. + /* #define GETWD    /**/
  781. + #ifdef HOMEMAIL
  782. + #define MAILFILE    "Mailbox"    /* or whatever */
  783. + #else /* HOMEMAIL */
  784. + #define MAILDIR        "/usr/spool/mail"
  785. + #endif /* HOMEMAIL */
  786. diff -rc --new-file orig/mush-7.2.5/curses.c mush-7.2.5/curses.c
  787. *** orig/mush-7.2.5/curses.c    Fri Oct 30 19:55:31 1992
  788. --- mush-7.2.5/curses.c    Sun Oct 17 15:22:30 1993
  789. ***************
  790. *** 487,504 ****
  791.   
  792.       /* order messages (sort) and redisplay the headers */
  793.       when C_SORT : case C_REV_SORT :
  794. !         (void) strcpy(file, "sort");
  795. !         if (c == C_REV_SORT) {
  796. !         print("Reverse "), turnon(glob_flags, CONT_PRNT);
  797. !         (void) strcat(file, " -");
  798. !         }
  799. !         print(
  800. !     "Order messages by [author, date, length, Status, subject, priority]: "
  801. !         );
  802. !         if ((c = m_getchar()) == 'a' || c == 'd' || c == 'l' ||
  803. !             c == 'S' || c == 's' || c == 'R' || c == 'p') {
  804.           print("reordering messages...");
  805. !         (void) cmd_line(sprintf(buf, "%s %c", file, c), msg_list);
  806.           print_more("done.");
  807.           if (ison(glob_flags, CNTD_CMD))
  808.               putchar('\n'), puts(compose_hdr(current_msg));
  809. --- 487,501 ----
  810.   
  811.       /* order messages (sort) and redisplay the headers */
  812.       when C_SORT : case C_REV_SORT :
  813. !         print((c == C_SORT) ? "Order " : "Reverse order ");
  814. !         turnon(glob_flags, CONT_PRNT);
  815. !         print("by [author, date, length, Status, subject, priority, to]: ");
  816. !         n = m_getchar();
  817. !         if (index("adlSRspt",n)) {
  818.           print("reordering messages...");
  819. !         sprintf(buf,"sort %s%c%s",(c == C_SORT) ? "" : "r",n,
  820. !             (n == 'd' || n == 'l') ? "" : "d");
  821. !         (void) cmd_line(buf, msg_list);
  822.           print_more("done.");
  823.           if (ison(glob_flags, CNTD_CMD))
  824.               putchar('\n'), puts(compose_hdr(current_msg));
  825. diff -rc --new-file orig/mush-7.2.5/folders.c mush-7.2.5/folders.c
  826. *** orig/mush-7.2.5/folders.c    Tue Mar 31 23:03:48 1992
  827. --- mush-7.2.5/folders.c    Wed Oct 27 17:14:57 1993
  828. ***************
  829. *** 85,91 ****
  830.        */
  831.       n = 0;
  832.       if (*tmp != '/') {
  833. !         if (!GetCwd(buf, sizeof buf)) {
  834.           error("getcwd: %s",buf);
  835.           return -1;
  836.           }
  837. --- 85,92 ----
  838.        */
  839.       n = 0;
  840.       if (*tmp != '/') {
  841. !         buf[0] = '\0';
  842. !         if (GetCwd(buf, sizeof buf) == NULL) {
  843.           error("getcwd: %s",buf);
  844.           return -1;
  845.           }
  846. ***************
  847. *** 132,137 ****
  848. --- 133,148 ----
  849.       xfree(msg[msg_cnt].m_date_recv);
  850.       xfree(msg[msg_cnt].m_date_sent);
  851.       msg[msg_cnt].m_date_recv = msg[msg_cnt].m_date_sent = NO_STRING;
  852. +     xfree(msg[msg_cnt].m_subject);
  853. +     xfree(msg[msg_cnt].m_target);
  854. +     xfree(msg[msg_cnt].m_source);
  855. +     xfree(msg[msg_cnt].m_from);
  856. +     xfree(msg[msg_cnt].m_name);
  857. +     xfree(msg[msg_cnt].m_addr);
  858. +     msg[msg_cnt].m_subject = NULL;
  859. +     msg[msg_cnt].m_target = msg[msg_cnt].m_source = NULL;
  860. +     msg[msg_cnt].m_from = msg[msg_cnt].m_name = msg[msg_cnt].m_addr = NULL;
  861. +     msg[msg_cnt].m_author = 0;
  862.       }
  863.       msg_cnt = 0, msg[0].m_offset = 0L;
  864.       turnoff(glob_flags, CONT_PRNT);
  865. ***************
  866. *** 677,683 ****
  867.       if (fputs(from, fp) == EOF)
  868.   #endif /* MSG_SEPARATOR */
  869.           art_cnt = -1;
  870. !     if (!(p = header_field(n, "from")))
  871.           p = "Mush-Undigest (Real author unknown)";
  872.       if (fprintf(fp, "From: %s\n", p) == EOF)
  873.           art_cnt = -1;
  874. --- 688,694 ----
  875.       if (fputs(from, fp) == EOF)
  876.   #endif /* MSG_SEPARATOR */
  877.           art_cnt = -1;
  878. !     if (!(p = header_field(n, "source")))
  879.           p = "Mush-Undigest (Real author unknown)";
  880.       if (fprintf(fp, "From: %s\n", p) == EOF)
  881.           art_cnt = -1;
  882. diff -rc --new-file orig/mush-7.2.5/hdrs.c mush-7.2.5/hdrs.c
  883. *** orig/mush-7.2.5/hdrs.c    Fri Oct 30 19:55:32 1992
  884. --- mush-7.2.5/hdrs.c    Wed Oct 27 17:27:46 1993
  885. ***************
  886. *** 52,58 ****
  887.    * "buf" and return its address.
  888.    */
  889.   char *
  890. ! header_field(n, str)
  891.   char *str;
  892.   {
  893.       static char    buf[HDRSIZ];
  894. --- 52,58 ----
  895.    * "buf" and return its address.
  896.    */
  897.   char *
  898. ! real_header_field(n, str)
  899.   char *str;
  900.   {
  901.       static char    buf[HDRSIZ];
  902. ***************
  903. *** 88,96 ****
  904. --- 88,231 ----
  905.       }
  906.       if (b > buf && *--b == ',')
  907.       *b = 0;
  908.       return (*buf)? buf: NULL;
  909.   }
  910.   
  911. + /*
  912. +  * To speed up sorting at the expense of some space we cache here
  913. +  * the subject and the to/newsgroups and reply-to/from fields.
  914. +  */
  915. + #define Strncpy(buf,p) (void)(strncpy(buf,p,sizeof(buf)),buf[sizeof(buf)-1]=0)
  916. + unsigned
  917. + author_of(n, from, name, addr, isauthor, show_to, to)
  918. + char from[HDRSIZ], name[HDRSIZ], addr[HDRSIZ], to[HDRSIZ];
  919. + unsigned *isauthor;
  920. + {
  921. +     register char *p, *p2;
  922. +     from[0] = name[0] = addr[0] = '\0';
  923. +     /* who's the message from */
  924. +     if ((p = reply_to(n, 0, from))) {
  925. +     /* NOTE:  this fails if the sender has '<' or '!' in
  926. +      * the RFC822 comment fields -- leading "comment"
  927. +      * or trailing (comment) -- but that isn't critical
  928. +      */
  929. +     if ((p2 = rindex(p, '!')) || (p2 = index(p, '<')))
  930. +         p = p2 + 1;
  931. +     } else
  932. +     p = strcpy(from, "unknown"); /* just in case */
  933. +     /* If the From field contains the user's login name, then the message
  934. +      * could be from the user -- attempt to give more useful information
  935. +      * by telling to whom the message was sent.  This is not possible if
  936. +      * the "to" header failed to get info (which is probably impossible).
  937. +      * Use take_me_off() to be sure the message really is from the current
  938. +      * user and not just someone with the same login at another site.
  939. +      */
  940. +     if (show_to /* && !strncmp(p, login, strlen(login)) */)
  941. +     (void) take_me_off(from);
  942. +     if (show_to && (*isauthor = !*from) && to) {  /* assign and test */
  943. +     (void) get_name_n_addr(to, name+4, addr+4);
  944. +     if (addr[4])
  945. +         (void) strncpy(addr, "TO: ", 4);
  946. +     if (name[4]) {  /* check to see if a name got added */
  947. +         (void) strncpy(name, "TO: ", 4);
  948. +         Strncpy(from, name);
  949. +     } else
  950. +         Strncpy(from, addr);
  951. +     } else
  952. +     (void) get_name_n_addr(from, name, addr);
  953. +     if (from[0] && msg[n].m_from == NULL)    msg[n].m_from = savestr(from);
  954. +     if (addr[0] && msg[n].m_addr == NULL)    msg[n].m_addr = savestr(addr);
  955. +     if (name[0] && msg[n].m_name == NULL)    msg[n].m_name = savestr(name);
  956. +     msg[n].m_author = 1;
  957. +     return (from[0] || addr[0] || name[0]);
  958. + }
  959. + char *
  960. + author_to(n, str)
  961. + char *str;
  962. + {
  963. +     register char *p;
  964. +     if (!msg[n].m_author) {
  965. +     char from[HDRSIZ], name[HDRSIZ], addr[HDRSIZ];
  966. +     author_of(n,from,name,addr,(unsigned *) 0,0,(char *) 0);
  967. +     }
  968. +     if ((p = msg[n].m_addr) != NULL) {
  969. +     Debug("author_to: msg %d: cached addr %s\n", n, p);
  970. +     strcpy(str,p);
  971. +     return str;
  972. +     }
  973. +     if ((p = msg[n].m_name) != NULL) {
  974. +     Debug("author_to: msg %d: cached name %s\n", n, p);
  975. +     strcpy(str,p);
  976. +     return str;
  977. +     }
  978. +     if ((p = msg[n].m_from) != NULL) {
  979. +     Debug("author_to: msg %d: cached from %s\n", n, p);
  980. +     strcpy(str,p);
  981. +     return str;
  982. +     }
  983. +     return NULL;
  984. + }
  985. + char *
  986. + header_field(n, str)
  987. + char *str;
  988. + {
  989. +     register char *p,*q;
  990. + #if 0 /* not used anywhere */
  991. +     if (!strcmp(str,"author")) {
  992. +     (p = author_to(n,str));
  993. +           if (p == NULL) return NULL;
  994. +     }
  995. +     else
  996. + #endif
  997. +     if (!strcmp(str,"subject")) {
  998. +     (p = q = msg[n].m_subject)
  999. +         || (p = real_header_field(n,"subject"));
  1000. +     if (p == NULL) return NULL;
  1001. +     if (q == NULL) msg[n].m_subject = savestr(p);
  1002. +     }
  1003. +     else if (!strcmp(str,"source")) {
  1004. +     (p = q = msg[n].m_source)
  1005. +         || (p = real_header_field(n,"from"))
  1006. +         || (p = real_header_field(n,"reply-to"))
  1007. +         || (p = real_header_field(n,"sender"))
  1008. +         || (p = real_header_field(n,"apparently-from"))
  1009. +         || (p = real_header_field(n,"resent-from"));
  1010. +     if (p == NULL) return NULL;
  1011. +     if (q == NULL) msg[n].m_source = savestr(p);
  1012. +     }
  1013. +     else if (!strcmp(str,"target")) {
  1014. +     (p = q = msg[n].m_target)
  1015. +         || (p = real_header_field(n,"to"))
  1016. +         || (p = real_header_field(n,"newsgroups"))
  1017. +         || (p = real_header_field(n,"resent-to"))
  1018. +         || (p = real_header_field(n,"apparently-to"));
  1019. +     if (p == NULL) return NULL;
  1020. +     if (q == NULL) msg[n].m_target = savestr(p);
  1021. +     }
  1022. +     else
  1023. +     p = real_header_field(n,str);
  1024. +     return p;
  1025. + }
  1026.   do_hdrs(argc, argv, list)
  1027.   register char **argv, list[];
  1028.   {
  1029. ***************
  1030. *** 333,340 ****
  1031.       return 0;
  1032.   }
  1033.   
  1034. - #define Strncpy(buf,p) (void)(strncpy(buf,p,sizeof(buf)),buf[sizeof(buf)-1]=0)
  1035.   /*
  1036.    * format a header from the information about a message (from, to, date,
  1037.    * subject, etc..).  The header for message number "cnt" is built and is
  1038. --- 468,473 ----
  1039. ***************
  1040. *** 389,430 ****
  1041.       user[0] = name[0] = Day[0] = Mon[0] = Tm[0] = Yr[0] = Wkday[0] = 0;
  1042.   
  1043.       /* who's the message to */
  1044. !     if ((p = header_field(cnt, "resent-to")) ||
  1045. !     (p = header_field(cnt, "to")) ||
  1046. !     (p = header_field(cnt, "apparently-to")))
  1047.       Strncpy(to, p);
  1048.   
  1049. !     /* who's the message from */
  1050. !     if ((p = header_field(cnt, "from")) && strcpy(from, p)
  1051. !         || (p = reply_to(cnt, 0, from))) {
  1052. !     /* NOTE:  this fails if the sender has '<' or '!' in
  1053. !      * the RFC822 comment fields -- leading "comment"
  1054. !      * or trailing (comment) -- but that isn't critical
  1055. !      */
  1056. !     if ((p2 = rindex(p, '!')) || (p2 = index(p, '<')))
  1057. !         p = p2 + 1;
  1058. !     } else
  1059. !     p = strcpy(from, "unknown"); /* just in case */
  1060. !     /* If the From field contains the user's login name, then the message
  1061. !      * could be from the user -- attempt to give more useful information
  1062. !      * by telling to whom the message was sent.  This is not possible if
  1063. !      * the "to" header failed to get info (which is probably impossible).
  1064. !      * Use take_me_off() to be sure the message really is from the current
  1065. !      * user and not just someone with the same login at another site.
  1066. !      */
  1067. !     if (show_to && !strncmp(p, login, strlen(login)))
  1068. !     (void) take_me_off(from);
  1069. !     if (show_to && (isauthor = !*from)) {  /* assign and test */
  1070. !     (void) get_name_n_addr(to, name+4, addr+4);
  1071. !     if (addr[4])
  1072. !         (void) strncpy(addr, "TO: ", 4);
  1073. !     if (name[4]) {  /* check to see if a name got added */
  1074. !         (void) strncpy(name, "TO: ", 4);
  1075. !         Strncpy(from, name);
  1076. !     } else
  1077. !         Strncpy(from, addr);
  1078. !     } else
  1079. !     (void) get_name_n_addr(from, name, addr);
  1080.   
  1081.       if (ison(glob_flags, DATE_RECV))
  1082.       date_p = msg[cnt].m_date_recv;
  1083. --- 522,531 ----
  1084.       user[0] = name[0] = Day[0] = Mon[0] = Tm[0] = Yr[0] = Wkday[0] = 0;
  1085.   
  1086.       /* who's the message to */
  1087. !     if ((p = header_field(cnt, "target")))
  1088.       Strncpy(to, p);
  1089.   
  1090. !     author_of(cnt, from, name, addr, &isauthor, show_to, to);
  1091.   
  1092.       if (ison(glob_flags, DATE_RECV))
  1093.       date_p = msg[cnt].m_date_recv;
  1094. ***************
  1095. *** 518,524 ****
  1096.           when 's': p2 = subject;
  1097.           when 'l': p2 = sprintf(lines, "%d", msg[cnt].m_lines);
  1098.           when 'c': p2 = sprintf(lines, "%ld", msg[cnt].m_size);
  1099. !         when 'i': (p2 = header_field(cnt, "message-id")) || (p2 = "");
  1100.           /* date formatting chars */
  1101.           when 'd': p2 = date; /* the full date */
  1102.           when 'T': p2 = Tm;
  1103. --- 619,625 ----
  1104.           when 's': p2 = subject;
  1105.           when 'l': p2 = sprintf(lines, "%d", msg[cnt].m_lines);
  1106.           when 'c': p2 = sprintf(lines, "%ld", msg[cnt].m_size);
  1107. !         when 'i': (p2 = real_header_field(cnt, "message-id")) || (p2 = "");
  1108.           /* date formatting chars */
  1109.           when 'd': p2 = date; /* the full date */
  1110.           when 'T': p2 = Tm;
  1111. ***************
  1112. *** 643,651 ****
  1113.       if (!p)
  1114.           print("Warning: message contains no `reply_to_hdr' headers.\n");
  1115.       }
  1116. !     if (p || (!p && ((p = header_field(n, field = "reply-to")) ||
  1117. !             (p = header_field(n, field = "from")) ||
  1118. !             (p = header_field(n, field = "return-path"))))) {
  1119.       skipspaces(0);
  1120.       } else if (!p) {
  1121.   DoFrom:
  1122. --- 744,752 ----
  1123.       if (!p)
  1124.           print("Warning: message contains no `reply_to_hdr' headers.\n");
  1125.       }
  1126. !     if (p || (!p && ((p = real_header_field(n, field = "reply-to")) ||
  1127. !             (p = real_header_field(n, field = "from")) ||
  1128. !             (p = real_header_field(n, field = "return-path"))))) {
  1129.       skipspaces(0);
  1130.       } else if (!p) {
  1131.   DoFrom:
  1132. ***************
  1133. *** 694,706 ****
  1134.        */
  1135.   BrokenFrom:
  1136.       if (!lcase_strncmp(field, "from_", -1) &&
  1137. !         (p = header_field(n, "resent-from")) ||
  1138. !             (p = header_field(n, "from")) ||
  1139. !             (p = header_field(n, "sender"))) {
  1140.           /* p2 is either NULL or addr (BrokenFrom) */
  1141.           (void) get_name_n_addr(p, name, p2);
  1142.       }
  1143. !     if (!name[0] && (p = header_field(n, "name")))
  1144.           (void) strcpy(name, p);
  1145.       if (name[0]) {
  1146.           if ((p = any(name, "(<,\"")) && (*p == ',' || *p == '<'))
  1147. --- 795,807 ----
  1148.        */
  1149.   BrokenFrom:
  1150.       if (!lcase_strncmp(field, "from_", -1) &&
  1151. !         (p = real_header_field(n, "resent-from")) ||
  1152. !             (p = real_header_field(n, "from")) ||
  1153. !             (p = real_header_field(n, "sender"))) {
  1154.           /* p2 is either NULL or addr (BrokenFrom) */
  1155.           (void) get_name_n_addr(p, name, p2);
  1156.       }
  1157. !     if (!name[0] && (p = real_header_field(n, "name")))
  1158.           (void) strcpy(name, p);
  1159.       if (name[0]) {
  1160.           if ((p = any(name, "(<,\"")) && (*p == ',' || *p == '<'))
  1161. ***************
  1162. *** 726,751 ****
  1163.        * The assumption that HDRSIZ is correct is unwise, but I know it
  1164.        * to be true for Mush.  Be forewarned if you call this routine.
  1165.        */
  1166. !     if (lim > 0 && (p = header_field(n, "resent-to")) && *p) {
  1167.           *b++ = ',', *b++ = ' ';
  1168.           p[lim] = '\0'; /* prevent overflow */
  1169.           b += Strcpy(b, p);
  1170.           lim = HDRSIZ - (b - buf) - 2;
  1171.       }
  1172. !     if (lim > 0 && (p = header_field(n, "to")) && *p) {
  1173.           *b++ = ',', *b++ = ' ';
  1174.           p[lim] = '\0'; /* prevent overflow */
  1175.           b += Strcpy(b, p);
  1176.           lim = HDRSIZ - (b - buf) - 2;
  1177.       }
  1178. !     if (lim > 0 && (p = header_field(n, "apparently-to")) && *p) {
  1179.           *b++ = ',', *b++ = ' ';
  1180.           p[lim] = '\0'; /* prevent overflow */
  1181.           b += Strcpy(b, p);
  1182.           lim = HDRSIZ - (b - buf) - 2;
  1183.       }
  1184.       /* Also append the Resent-From address if there is one. */
  1185. !     if (lim > 0 && (p = header_field(n, "resent-from")) && *p) {
  1186.           *b++ = ',', *b++ = ' ';
  1187.           p[lim] = '\0'; /* prevent overflow */
  1188.           (void) strcpy(b, p);
  1189. --- 827,852 ----
  1190.        * The assumption that HDRSIZ is correct is unwise, but I know it
  1191.        * to be true for Mush.  Be forewarned if you call this routine.
  1192.        */
  1193. !     if (lim > 0 && (p = real_header_field(n, "resent-to")) && *p) {
  1194.           *b++ = ',', *b++ = ' ';
  1195.           p[lim] = '\0'; /* prevent overflow */
  1196.           b += Strcpy(b, p);
  1197.           lim = HDRSIZ - (b - buf) - 2;
  1198.       }
  1199. !     if (lim > 0 && (p = real_header_field(n, "to")) && *p) {
  1200.           *b++ = ',', *b++ = ' ';
  1201.           p[lim] = '\0'; /* prevent overflow */
  1202.           b += Strcpy(b, p);
  1203.           lim = HDRSIZ - (b - buf) - 2;
  1204.       }
  1205. !     if (lim > 0 && (p = real_header_field(n, "apparently-to")) && *p) {
  1206.           *b++ = ',', *b++ = ' ';
  1207.           p[lim] = '\0'; /* prevent overflow */
  1208.           b += Strcpy(b, p);
  1209.           lim = HDRSIZ - (b - buf) - 2;
  1210.       }
  1211.       /* Also append the Resent-From address if there is one. */
  1212. !     if (lim > 0 && (p = real_header_field(n, "resent-from")) && *p) {
  1213.           *b++ = ',', *b++ = ' ';
  1214.           p[lim] = '\0'; /* prevent overflow */
  1215.           (void) strcpy(b, p);
  1216. ***************
  1217. *** 780,786 ****
  1218.   {
  1219.       register char *p;
  1220.       buf[0] = 0; /* make sure it's already null terminated */
  1221. !     if (!(p = header_field(n, "subject")))
  1222.       return NULL;
  1223.       if (lcase_strncmp(p, "Re:", 3))
  1224.       (void) strcpy(buf, "Re: ");
  1225. --- 881,887 ----
  1226.   {
  1227.       register char *p;
  1228.       buf[0] = 0; /* make sure it's already null terminated */
  1229. !     if (!(p = header_field(n,"subject")))
  1230.       return NULL;
  1231.       if (lcase_strncmp(p, "Re:", 3))
  1232.       (void) strcpy(buf, "Re: ");
  1233. ***************
  1234. *** 793,799 ****
  1235.   {
  1236.       register char *p;
  1237.       buf[0] = 0; /* make sure it's already null terminated */
  1238. !     if (!(p = header_field(n, "cc")))
  1239.       return NULL;
  1240.       fix_up_addr(p);
  1241.       if (!do_set(set_options, "metoo"))
  1242. --- 894,900 ----
  1243.   {
  1244.       register char *p;
  1245.       buf[0] = 0; /* make sure it's already null terminated */
  1246. !     if (!(p = real_header_field(n, "cc")))
  1247.       return NULL;
  1248.       fix_up_addr(p);
  1249.       if (!do_set(set_options, "metoo"))
  1250. diff -rc --new-file orig/mush-7.2.5/init.c mush-7.2.5/init.c
  1251. *** orig/mush-7.2.5/init.c    Fri Oct 30 19:55:33 1992
  1252. --- mush-7.2.5/init.c    Mon Sep 13 10:56:28 1993
  1253. ***************
  1254. *** 19,25 ****
  1255. --- 19,27 ----
  1256.       extern char        *getlogin();
  1257.       char        buf[MAXPATHLEN];
  1258.   #if defined(SYSV) && !defined(HPUX) && !defined(IRIX4)
  1259. + #ifndef __linux__
  1260.       extern struct passwd *getpwuid();  /* sys-v forgot this in pwd.h! */
  1261. + #endif
  1262.       struct utsname ourhost;
  1263.   #else
  1264.       char ourhost[128];
  1265. diff -rc --new-file orig/mush-7.2.5/lock.c mush-7.2.5/lock.c
  1266. *** orig/mush-7.2.5/lock.c    Fri Oct 30 19:55:34 1992
  1267. --- mush-7.2.5/lock.c    Fri Oct 15 12:54:32 1993
  1268. ***************
  1269. *** 14,19 ****
  1270. --- 14,25 ----
  1271.   #include <sys/locking.h>
  1272.   #endif /* SYSV && !USG */
  1273.   
  1274. + #ifdef __linux__
  1275. + #undef USG
  1276. + #undef SYSV
  1277. + #define BSD
  1278. + #endif
  1279.   #ifdef DOT_LOCK
  1280.   
  1281.   #ifndef DOLOCK_PATH
  1282. ***************
  1283. *** 253,258 ****
  1284. --- 259,265 ----
  1285.   /*
  1286.    * Define some BSD names for the SYSV world
  1287.    */
  1288. + #if !defined(LOCK_SH) && !defined(__linux__)
  1289.   #ifdef USG
  1290.   #define LOCK_SH F_RDLCK
  1291.   #define LOCK_EX F_WRLCK
  1292. ***************
  1293. *** 263,268 ****
  1294. --- 270,276 ----
  1295.   #define LOCK_UN LK_UNLCK
  1296.   #endif /* USG */
  1297.   #define LOCK_NB 0    /* Always non-blocking in this case */
  1298. + #endif /* !LOCK_SH && !__linux__ */
  1299.   
  1300.   #ifdef EWOULDBLOCK
  1301.   #undef EWOULDBLOCK
  1302. diff -rc --new-file orig/mush-7.2.5/mail.c mush-7.2.5/mail.c
  1303. *** orig/mush-7.2.5/mail.c    Fri Oct 30 19:55:36 1992
  1304. --- mush-7.2.5/mail.c    Wed Oct 27 18:10:47 1993
  1305. ***************
  1306. *** 1076,1089 ****
  1307.   
  1308.       tmpf = ed_fp;
  1309.       msg[msg_cnt].m_offset = 0L;
  1310. !     if (p = header_field(msg_cnt, "to")) {
  1311.           (void) strcpy(To, p);
  1312.           Cc[0] = Bcc[0] = 0;
  1313. !         if (p = header_field(msg_cnt, "cc"))
  1314.           (void) strcpy(Cc, p);
  1315. !         if (p = header_field(msg_cnt, "bcc"))
  1316.           (void) strcpy(Bcc, p);
  1317. !         if (p = header_field(msg_cnt, "fcc"))
  1318.           next_file += find_files(p, names+next_file, size-next_file, 1);
  1319.       } else
  1320.           *To = 0; /* Error caught below */
  1321. --- 1076,1089 ----
  1322.   
  1323.       tmpf = ed_fp;
  1324.       msg[msg_cnt].m_offset = 0L;
  1325. !     if (p = real_header_field(msg_cnt, "to")) {
  1326.           (void) strcpy(To, p);
  1327.           Cc[0] = Bcc[0] = 0;
  1328. !         if (p = real_header_field(msg_cnt, "cc"))
  1329.           (void) strcpy(Cc, p);
  1330. !         if (p = real_header_field(msg_cnt, "bcc"))
  1331.           (void) strcpy(Bcc, p);
  1332. !         if (p = real_header_field(msg_cnt, "fcc"))
  1333.           next_file += find_files(p, names+next_file, size-next_file, 1);
  1334.       } else
  1335.           *To = 0; /* Error caught below */
  1336. diff -rc --new-file orig/mush-7.2.5/main.c mush-7.2.5/main.c
  1337. *** orig/mush-7.2.5/main.c    Fri Oct 30 19:55:37 1992
  1338. --- mush-7.2.5/main.c    Mon Sep 13 11:44:19 1993
  1339. ***************
  1340. *** 333,338 ****
  1341. --- 333,339 ----
  1342.   {
  1343.       char cwd[MAXPATHLEN];
  1344.   
  1345. +     cwd[0] = '\0';
  1346.       if (GetCwd(cwd, MAXPATHLEN) == NULL) {
  1347.       error("set_cwd: %s", cwd);
  1348.       (void) un_set(&set_options, "cwd");
  1349. diff -rc --new-file orig/mush-7.2.5/makefile.linux mush-7.2.5/makefile.linux
  1350. *** orig/mush-7.2.5/makefile.linux    Thu Jan  1 01:00:00 1970
  1351. --- mush-7.2.5/makefile.linux    Sun Oct 17 18:34:50 1993
  1352. ***************
  1353. *** 0 ****
  1354. --- 1,70 ----
  1355. + # makefile.linux    (c) copyright 1991    (Dan Heller)
  1356. + #
  1357. + HDRS= mush.h config.h-dist strings.h bindings.h options.h version.h glob.h pop.h
  1358. + SRCS= main.c init.c misc.c mail.c hdrs.c execute.c commands.c print.c dates.c \
  1359. +       signals.c setopts.c msgs.c pick.c sort.c expr.c folders.c \
  1360. +       loop.c viewopts.c curses.c curs_io.c bind.c file.c strings.c \
  1361. +       lock.c macros.c options.c addrs.c malloc.c glob.c command2.c \
  1362. +       pop.c pmush.c xcreat.c
  1363. + OBJS= main.o init.o misc.o mail.o hdrs.o execute.o commands.o print.o file.o \
  1364. +       signals.o setopts.o msgs.o pick.o sort.o expr.o strings.o \
  1365. +       folders.o dates.o loop.o viewopts.o curses.o curs_io.o bind.o \
  1366. +       lock.o macros.o options.o addrs.o malloc.o glob.o command2.o \
  1367. +       pop.o pmush.o xcreat.o
  1368. + HELP_FILES= README README-7.0 README-7.1 README-7.2.0 README-7.2.2 \
  1369. +     README-7.2.4 mush.1 cmd_help Mushrc Mailrc Gnurc \
  1370. +     sample.mushrc advanced.mushrc digestify
  1371. + MAKES= makefile.bsd makefile.xenix makefile.sys.v makefile.hpux makefile.sun
  1372. + # See the README for changes needed to compile under Ultrix.
  1373. + # In particular, you may need -DSIGRET=void and/or -ltermcap.
  1374. + CFLAGS= -g -fwritable-strings -DSYSV -DUSG -DCURSES -DSIGRET=void
  1375. + LDFLAGS= -g -static
  1376. + LINTFLAGS= -bxah -Dlint -DCURSES -DBSD -D_BSD_SOURCE
  1377. + LIBS= -lcurses -ltermcap
  1378. + OTHERLIBS=
  1379. + # Use some variant of this one if you #define MMDF in config.h
  1380. + #OTHERLIBS=/usr/src/mmdf/lib/libmmdf.a
  1381. + mush: $(OBJS)
  1382. +     @echo loading...
  1383. +     @cc $(LDFLAGS) $(OBJS) $(LIBS) $(OTHERLIBS) -o mush
  1384. + $(OBJS): config.h mush.h
  1385. + loop.o: version.h
  1386. + tape:
  1387. +     @tar cv $(MAKES) $(HDRS) $(SRCS) $(HELP_FILES)
  1388. + tar:
  1389. +     @tar fcv MUSH $(MAKES) $(HDRS) $(SRCS) $(HELP_FILES)
  1390. + tarmail:
  1391. +     tar fcv - $(MAKES) $(HDRS) $(SRCS) $(HELP_FILES) | \
  1392. +     compress | btoa > mush.tarmail
  1393. + lint:
  1394. +     lint $(LINTFLAGS) $(SRCS)
  1395. + clean:
  1396. +     rm -f *.o core mush
  1397. + BINDIR= /usr/bin
  1398. + LIBDIR= /usr/lib
  1399. + MRCDIR= /usr/lib
  1400. + MANDIR= /usr/man/man1
  1401. + MANEXT= 1
  1402. + install: mush
  1403. +     mv mush $(BINDIR)
  1404. +     strip $(BINDIR)/mush
  1405. +     chmod 0755 $(BINDIR)/mush
  1406. +     cp mush.1 $(MANDIR)/mush.$(MANEXT)
  1407. +     chmod 0644 $(MANDIR)/mush.$(MANEXT)
  1408. +     cp cmd_help $(LIBDIR)
  1409. +     chmod 0644 $(LIBDIR)/cmd_help
  1410. +     cp Mushrc $(MRCDIR)/Mushrc
  1411. +     chmod 0644 $(MRCDIR)/Mushrc
  1412. diff -rc --new-file orig/mush-7.2.5/makefile.svr4 mush-7.2.5/makefile.svr4
  1413. *** orig/mush-7.2.5/makefile.svr4    Thu Jan  1 01:00:00 1970
  1414. --- mush-7.2.5/makefile.svr4    Sat Sep 11 20:36:54 1993
  1415. ***************
  1416. *** 0 ****
  1417. --- 1,62 ----
  1418. + # Mush makefile for system V.4.  Note: SIGRET should return void for normal
  1419. + # sys-v, but Att PC users should *not* have it defined.  See the README!!
  1420. + #
  1421. + HDRS1= mush.h config.h
  1422. + HDRS2= strings.h options.h
  1423. + HDRS3= bindings.h glob.h
  1424. + HDRS4= version.h
  1425. + SRCS1= commands.c dates.c execute.c expr.c folders.c \
  1426. +     hdrs.c init.c loop.c mail.c main.c misc.c msgs.c pick.c \
  1427. +     print.c setopts.c signals.c sort.c viewopts.c options.c lock.c
  1428. + SRCS2= bind.c curs_io.c curses.c file.c strings.c macros.c \
  1429. +     addrs.c malloc.c glob.c command2.c
  1430. + OBJS1= commands.o dates.o execute.o expr.o folders.o \
  1431. +     hdrs.o init.o loop.o mail.o main.o misc.o msgs.o pick.o \
  1432. +     print.o setopts.o signals.o sort.o viewopts.o options.o lock.o
  1433. + OBJS2= bind.o curs_io.o curses.o file.o strings.o macros.o \
  1434. +     addrs.o malloc.o glob.o command2.o
  1435. + HELP= README README-7.0 README-7.1 README-7.2.0 README-7.2.2 mush.1 \
  1436. +     cmd_help Mushrc Mailrc Gnurc sample.mushrc advanced.mushrc digestify
  1437. + # Sun OS systems who wish to compile with sys-v options:
  1438. + # CC= /usr/5bin/cc
  1439. + # CFLAGS=     -O -DSYSV -DCURSES -DUSG -DDIRECTORY
  1440. + # LIBS= -L/usr/5lib -lcurses
  1441. + # IRIX 3.2 systems (SGI Iris workstations) should add -DDIRECTORY to CFLAGS
  1442. + # SCO UNIX 3.2 should add -DDIRECTORY -DSELECT and should avoid library -lx
  1443. + CFLAGS=     -O -DSYSV -DUSG -DDIRECTORY -DSELECT -DCURSES -DREGCMP -DSIGRET=void
  1444. + LDFLAGS=
  1445. + LIBS=         -lcurses -lsocket -lnsl -lgen $$LDPATH -lmalloc
  1446. + OTHERLIBS=
  1447. + # Use some variant of this one if you #define MMDF in config.h
  1448. + #OTHERLIBS=/usr/src/mmdf/lib/libmmdf.a
  1449. + PROG=        mush
  1450. + $(PROG): $(OBJS1) $(OBJS2)
  1451. +     @echo loading...
  1452. +     @$(CC) $(LDFLAGS) $(OBJS1) $(OBJS2) -o $(PROG) $(LIBS) $(OTHERLIBS)
  1453. + $(OBJS1): $(HDRS1) $(HDRS2)
  1454. + $(OBJS2): $(HDRS1) $(HDRS2) $(HDRS3)
  1455. + loop.o: version.h
  1456. + BINDIR= /usr/local/bin
  1457. + LIBDIR= /usr/local/lib
  1458. + MRCDIR= /usr/local/lib
  1459. + MANDIR= /usr/local/man/man1
  1460. + MANEXT= 1
  1461. + install: mush
  1462. +     cp mush $(BINDIR)
  1463. +     strip $(BINDIR)/mush
  1464. +     chmod 0755 $(BINDIR)/mush
  1465. +     cp mush.1 $(MANDIR)/mush.$(MANEXT)
  1466. +     chmod 0644 $(MANDIR)/mush.$(MANEXT)
  1467. +     cp cmd_help $(LIBDIR)
  1468. +     chmod 0644 $(LIBDIR)/cmd_help
  1469. +     cp Mushrc $(MRCDIR)/Mushrc
  1470. +     chmod 0644 $(MRCDIR)/Mushrc
  1471. diff -rc --new-file orig/mush-7.2.5/msgs.c mush-7.2.5/msgs.c
  1472. *** orig/mush-7.2.5/msgs.c    Fri Oct 30 19:55:39 1992
  1473. --- mush-7.2.5/msgs.c    Fri Oct 15 12:43:53 1993
  1474. ***************
  1475. *** 171,177 ****
  1476.       }
  1477.   
  1478.       if (ison(flags, UPDATE_STATUS))
  1479. !         if (!strncmp(line, "Status:", 7) || !strncmp(line, "Priority:", 9))
  1480.           continue; /* ignore "Status" and "Priority" lines */
  1481.           else if (!on_hdr) {
  1482.           int i, write_priority = 0;
  1483. --- 171,177 ----
  1484.       }
  1485.   
  1486.       if (ison(flags, UPDATE_STATUS))
  1487. !         if (!lcase_strncmp(line, "Status:", 7) || !lcase_strncmp(line, "Priority:", 9))
  1488.           continue; /* ignore "Status" and "Priority" lines */
  1489.           else if (!on_hdr) {
  1490.           int i, write_priority = 0;
  1491. ***************
  1492. *** 516,522 ****
  1493. --- 516,524 ----
  1494.       struct utimbuf times[1];
  1495.       (void) fflush(mail_fp); /* just in case */
  1496.       times[0].modtime = time(×[0].actime) - 2;
  1497. + #ifndef __linux__
  1498.       times[0].ausec = times[0].modusec = 0;
  1499. + #endif /* !__linux__ */
  1500.   #else /* !POSIX_UTIME */
  1501.       long times[2];
  1502.       (void) fflush(mail_fp); /* just in case */
  1503. ***************
  1504. *** 744,757 ****
  1505.   
  1506.       path[0] = '\0';
  1507.       while (fgets(buf, sizeof buf, fp)) {
  1508. !     if (strncmp(buf, ">From ", 6))
  1509.           break;
  1510.       p = buf + 6;
  1511.   
  1512.       (void) sscanf(p, "%s", user);
  1513.   
  1514.       while (p = index(p+1, 'r')) {
  1515. !         if (!strncmp(p, "remote from ", 12)) {
  1516.           char *p2 = path+strlen(path);
  1517.           skipspaces(12);
  1518.           (void) sscanf(p, "%s", p2); /* add the new machine to current path */
  1519. --- 746,759 ----
  1520.   
  1521.       path[0] = '\0';
  1522.       while (fgets(buf, sizeof buf, fp)) {
  1523. !     if (lcase_strncmp(buf, ">From ", 6))
  1524.           break;
  1525.       p = buf + 6;
  1526.   
  1527.       (void) sscanf(p, "%s", user);
  1528.   
  1529.       while (p = index(p+1, 'r')) {
  1530. !         if (!lcase_strncmp(p, "remote from ", 12)) {
  1531.           char *p2 = path+strlen(path);
  1532.           skipspaces(12);
  1533.           (void) sscanf(p, "%s", p2); /* add the new machine to current path */
  1534. ***************
  1535. *** 922,935 ****
  1536.                   strdup(msg[cnt].m_date_recv, p);
  1537.               } else
  1538.   #endif /* MMDF */
  1539. !             if (!strncmp(buf, "Date:", 5))
  1540.               strdup(msg[cnt].m_date_sent, parse_date(p+5));
  1541.               else if (!msg[cnt].m_date_sent &&
  1542. !                 !strncmp(buf, "Resent-Date:", 12))
  1543.               msg[cnt].m_date_sent = savestr(parse_date(p+12));
  1544. !             else if (!strncmp(buf, "Content-Type:", 13))
  1545.               turnon(msg[cnt].m_flags, METAMAIL);
  1546. !             else if (!strncmp(buf, "Priority:", 9)) {
  1547.               for (p += 9 ; *p != '\n'; p++) {
  1548.                   if (!isalpha(*p) || upper(*p) > 'A' + MAX_PRIORITY)
  1549.                   continue;
  1550. --- 924,937 ----
  1551.                   strdup(msg[cnt].m_date_recv, p);
  1552.               } else
  1553.   #endif /* MMDF */
  1554. !             if (!lcase_strncmp(buf, "Date:", 5))
  1555.               strdup(msg[cnt].m_date_sent, parse_date(p+5));
  1556.               else if (!msg[cnt].m_date_sent &&
  1557. !                 !lcase_strncmp(buf, "Resent-Date:", 12))
  1558.               msg[cnt].m_date_sent = savestr(parse_date(p+12));
  1559. !             else if (!lcase_strncmp(buf, "Content-Type:", 13))
  1560.               turnon(msg[cnt].m_flags, METAMAIL);
  1561. !             else if (!lcase_strncmp(buf, "Priority:", 9)) {
  1562.               for (p += 9 ; *p != '\n'; p++) {
  1563.                   if (!isalpha(*p) || upper(*p) > 'A' + MAX_PRIORITY)
  1564.                   continue;
  1565. ***************
  1566. *** 937,943 ****
  1567.                   M_PRIORITY(upper(*p) - 'A' + 1));
  1568.               }
  1569.               } else if (get_status &&
  1570. !                 !(get_status = strncmp(p, "Status:", 7))) {
  1571.               /* new mail should not have a Status: field! */
  1572.               turnon(msg[cnt].m_flags, OLD);
  1573.               for (p += 7 ; *p != '\n'; p++) {
  1574. --- 939,945 ----
  1575.                   M_PRIORITY(upper(*p) - 'A' + 1));
  1576.               }
  1577.               } else if (get_status &&
  1578. !                 !(get_status = lcase_strncmp(p, "Status:", 7))) {
  1579.               /* new mail should not have a Status: field! */
  1580.               turnon(msg[cnt].m_flags, OLD);
  1581.               for (p += 7 ; *p != '\n'; p++) {
  1582. diff -rc --new-file orig/mush-7.2.5/mush.1 mush-7.2.5/mush.1
  1583. *** orig/mush-7.2.5/mush.1    Fri Oct 30 19:55:03 1992
  1584. --- mush-7.2.5/mush.1    Wed Oct 27 18:07:40 1993
  1585. ***************
  1586. *** 3249,3255 ****
  1587.   .B home
  1588.   variable descriptions for more information.
  1589.   .TP
  1590. ! .BR sort " [\-i] [[\-r] \-a | \-d | \-l | \-p | \-R | \-s | \-S]"
  1591.   This command sorts messages according to author, date, status or subject
  1592.   (with or without considering the \*QRe:\ \*U, in replied messages).
  1593.   In addition, the messages can be sorted in reverse order (same arguments).
  1594. --- 3249,3255 ----
  1595.   .B home
  1596.   variable descriptions for more information.
  1597.   .TP
  1598. ! .BR sort " [\-i] [[\-r] \-a \-t | \-d | \-l | \-p | \-R | \-s | \-S]"
  1599.   This command sorts messages according to author, date, status or subject
  1600.   (with or without considering the \*QRe:\ \*U, in replied messages).
  1601.   In addition, the messages can be sorted in reverse order (same arguments).
  1602. ***************
  1603. *** 3261,3266 ****
  1604. --- 3261,3267 ----
  1605.   \-i    ignore case in alphabetical sorts
  1606.   \-r    reverse sort order of next option
  1607.   \-a    sort by author (alphabetical)
  1608. + \-t    sort by target (alphabetical)
  1609.   \-d    sort by date
  1610.   \-l    sort by length of message
  1611.   \-p    sort by message priority
  1612. diff -rc --new-file orig/mush-7.2.5/mush.h mush-7.2.5/mush.h
  1613. *** orig/mush-7.2.5/mush.h    Fri Oct 30 19:55:40 1992
  1614. --- mush-7.2.5/mush.h    Wed Oct 27 17:55:45 1993
  1615. ***************
  1616. *** 2,7 ****
  1617. --- 2,11 ----
  1618.   
  1619.   #include "config.h"
  1620.   
  1621. + #if __STDC__
  1622. + # include <unistd.h>
  1623. + #endif
  1624.   #ifdef CURSES
  1625.   
  1626.   #ifdef USG
  1627. ***************
  1628. *** 31,37 ****
  1629.   #else /* CURSES */
  1630.   #include <stdio.h>
  1631.   #if defined(SYSV) && defined(USG) || defined(AIX)
  1632. ! #include <termio.h>
  1633.   #endif /* SYSV && USG */
  1634.   #endif /* CURSES */
  1635.   
  1636. --- 35,45 ----
  1637.   #else /* CURSES */
  1638.   #include <stdio.h>
  1639.   #if defined(SYSV) && defined(USG) || defined(AIX)
  1640. ! # ifdef __linux__
  1641. ! #   include <termios.h>
  1642. ! # else
  1643. ! #   include <termio.h>
  1644. ! # endif
  1645.   #endif /* SYSV && USG */
  1646.   #endif /* CURSES */
  1647.   
  1648. ***************
  1649. *** 87,97 ****
  1650.   #        include <sys/select.h>
  1651.   #    endif /* M_UNIX */
  1652.   #    include <fcntl.h>
  1653.   #    endif /* SYSV */
  1654.   #endif /* SUNTOOL */
  1655.   
  1656.   #ifdef POSIX_UTIME
  1657. ! #include <sys/utime.h>
  1658.   #endif /* POSIX_UTIME */
  1659.   #include <sys/stat.h>
  1660.   #include <sys/file.h>
  1661. --- 95,112 ----
  1662.   #        include <sys/select.h>
  1663.   #    endif /* M_UNIX */
  1664.   #    include <fcntl.h>
  1665. + #    ifndef __linux__
  1666. + #      undef TIOCGLTC
  1667. + #    endif
  1668.   #    endif /* SYSV */
  1669.   #endif /* SUNTOOL */
  1670.   
  1671.   #ifdef POSIX_UTIME
  1672. ! # ifdef __linux__
  1673. ! #   include <utime.h>
  1674. ! # else
  1675. ! #   include <sys/utime.h>
  1676. ! # endif
  1677.   #endif /* POSIX_UTIME */
  1678.   #include <sys/stat.h>
  1679.   #include <sys/file.h>
  1680. ***************
  1681. *** 173,182 ****
  1682.   #endif /* nocrmode */
  1683.   
  1684.   unsigned char vmin, vtime;
  1685. ! #define sg_erase  c_cc[2]
  1686.   #define sg_flags  c_lflag
  1687. ! #define sg_kill   c_cc[3]
  1688.   #define sg_ospeed c_cflag
  1689.   #define gtty(fd, SGTTYbuf)    ioctl(fd, TCGETA, SGTTYbuf)
  1690.   #undef stty
  1691.   #define stty(fd, SGTTYbuf)    ioctl(fd, TCSETAW, SGTTYbuf)
  1692. --- 188,203 ----
  1693.   #endif /* nocrmode */
  1694.   
  1695.   unsigned char vmin, vtime;
  1696. ! #define sg_erase  c_cc[VERASE]
  1697.   #define sg_flags  c_lflag
  1698. ! #define sg_kill   c_cc[VKILL]
  1699.   #define sg_ospeed c_cflag
  1700. + #ifdef __linux__
  1701. + # undef TCGETA
  1702. + # undef TCSETAW
  1703. + # define TCGETA TCGETS
  1704. + # define TCSETAW TCSETSW
  1705. + #endif
  1706.   #define gtty(fd, SGTTYbuf)    ioctl(fd, TCGETA, SGTTYbuf)
  1707.   #undef stty
  1708.   #define stty(fd, SGTTYbuf)    ioctl(fd, TCSETAW, SGTTYbuf)
  1709. ***************
  1710. *** 187,200 ****
  1711.   #define cbrkoff()  \
  1712.       (_tty.sg_flags |= ICANON,_tty.c_cc[VMIN] = vmin,_tty.c_iflag |= ICRNL, \
  1713.           _tty.c_cc[VTIME] = vtime, stty(0, &_tty))
  1714. ! #define savetty()  \
  1715.       (void) gtty(0, &_tty), vtime = _tty.c_cc[VTIME], vmin = _tty.c_cc[VMIN]
  1716. ! #define cbreak()   cbrkon()
  1717. ! #define nocbreak() cbrkoff()
  1718.   
  1719.   /* If curses isn't defined, declare our 'tty' and macros for echo/cbreak */
  1720.   #ifndef CURSES
  1721. ! typedef struct termio SGTTY;
  1722.   #define echom()    echon()
  1723.   #define noechom()  echoff()
  1724.   #define crmode()   cbrkon()
  1725. --- 208,238 ----
  1726.   #define cbrkoff()  \
  1727.       (_tty.sg_flags |= ICANON,_tty.c_cc[VMIN] = vmin,_tty.c_iflag |= ICRNL, \
  1728.           _tty.c_cc[VTIME] = vtime, stty(0, &_tty))
  1729. ! #ifdef __linux__
  1730. ! # undef savetty
  1731. ! # undef cbreak
  1732. ! # undef nocbreak
  1733. ! #endif
  1734. ! #ifndef savetty
  1735. ! # define savetty()  \
  1736.       (void) gtty(0, &_tty), vtime = _tty.c_cc[VTIME], vmin = _tty.c_cc[VMIN]
  1737. ! #endif
  1738. ! #ifndef cbreak
  1739. ! # define cbreak()   cbrkon()
  1740. ! #endif
  1741. ! #ifndef nocbreak
  1742. ! # define nocbreak() cbrkoff()
  1743. ! #endif
  1744.   
  1745.   /* If curses isn't defined, declare our 'tty' and macros for echo/cbreak */
  1746.   #ifndef CURSES
  1747. ! #ifdef __linux__
  1748. !   typedef struct termios SGTTY;
  1749. ! #else
  1750. !   typedef struct termio SGTTY;
  1751. ! #endif
  1752.   #define echom()    echon()
  1753.   #define noechom()  echoff()
  1754.   #define crmode()   cbrkon()
  1755. ***************
  1756. *** 403,408 ****
  1757. --- 441,448 ----
  1758.   #define HELP_TEXT   ULBIT(25) /* create textsw frame for paging help messages */
  1759.   #define CORRUPTED   ULBIT(26) /* error loading new mail has occurred */
  1760.   
  1761. + #define DONT_CHECK  (DO_SHELL|IS_PIPE|IGN_SIGS|IS_GETTING|READ_ONLY|REDIRECT|CNTD_CMD|IS_SENDING|IN_MACRO)
  1762.   /* flags to control composition */
  1763.   #define VERBOSE        ULBIT(0)  /* verbose flag for sendmail */
  1764.   #define INCLUDE        ULBIT(1)  /* include msg in response */
  1765. ***************
  1766. *** 446,451 ****
  1767. --- 486,498 ----
  1768.       int    m_lines;    /* number of lines in msg */
  1769.       char   *m_date_recv;/* Date user received msg (see dates.c for fmt) */
  1770.       char   *m_date_sent;/* Date author sent msg (see dates.c for fmt) */
  1771. +     char   *m_source;    /* Cached From: or Reply-To: field */
  1772. +     char   *m_target;    /* Cached To: or Newsgroups: field */
  1773. +     char   *m_subject;    /* Cached Subject: field */
  1774. +     char   *m_from;    /* Cached Reply-To: or From: field */
  1775. +     char   *m_addr;    /* Cached Reply-To: or From: field */
  1776. +     char   *m_name;    /* Cached Reply-To: or From: field */
  1777. +     char   m_author;    /* if any of the 3 preceding ones has been inited */
  1778.   } msg[MAXMSGS];
  1779.   
  1780.   struct options {
  1781. ***************
  1782. *** 526,532 ****
  1783.       *cc_to(),         /* when responding, return str which is the cc-list */
  1784.       *compose_hdr(),    /* passes hdr_format to format_hdr() for displays */
  1785.       *format_hdr(),    /* returns a formatted line describing passed msg # */
  1786. !     *header_field(),    /* the line in msg described by arg (message header) */
  1787.       *reply_to(),    /* who do we reply to when responding */
  1788.       *subject_to(),      /* when responding, return str which is the subject */
  1789.   
  1790. --- 573,580 ----
  1791.       *cc_to(),         /* when responding, return str which is the cc-list */
  1792.       *compose_hdr(),    /* passes hdr_format to format_hdr() for displays */
  1793.       *format_hdr(),    /* returns a formatted line describing passed msg # */
  1794. !     *real_header_field(),/* the line in msg described by arg (message header) */
  1795. !     *header_field(),    /* like the real_ version, but cached or extended */
  1796.       *reply_to(),    /* who do we reply to when responding */
  1797.       *subject_to(),      /* when responding, return str which is the subject */
  1798.   
  1799. ***************
  1800. *** 589,597 ****
  1801.   #ifdef TIOCGLTC
  1802.   struct ltchars ltchars;            /* tty character settings */
  1803.   #endif /* TIOCGLTC */
  1804. ! #if defined(BSD) && !defined(AIX) /* (TIOCGETC) */
  1805.   struct tchars  tchars;            /* more tty character settings */
  1806. ! #endif /* BSD && !AIX (TIOCGETC) */
  1807.   
  1808.   #ifdef CURSES
  1809.   
  1810. --- 637,645 ----
  1811.   #ifdef TIOCGLTC
  1812.   struct ltchars ltchars;            /* tty character settings */
  1813.   #endif /* TIOCGLTC */
  1814. ! #if defined(BSD) && !defined(AIX)
  1815.   struct tchars  tchars;            /* more tty character settings */
  1816. ! #endif /* BSD && !AIX */
  1817.   
  1818.   #ifdef CURSES
  1819.   
  1820. diff -rc --new-file orig/mush-7.2.5/pick.c mush-7.2.5/pick.c
  1821. *** orig/mush-7.2.5/pick.c    Fri Oct 30 19:55:41 1992
  1822. --- mush-7.2.5/pick.c    Wed Oct 27 17:21:38 1993
  1823. ***************
  1824. *** 370,376 ****
  1825.               if (!(p = header_field(n, "subject")))
  1826.               break;
  1827.           } else if (search_from) {
  1828. !             if (!(p = header_field(n, "from"))) {
  1829.               /*
  1830.                * Check for MSG_SEPARATOR here?  Maybe not...
  1831.                */
  1832. --- 370,376 ----
  1833.               if (!(p = header_field(n, "subject")))
  1834.               break;
  1835.           } else if (search_from) {
  1836. !             if (!(p = header_field(n, "source"))) {
  1837.               /*
  1838.                * Check for MSG_SEPARATOR here?  Maybe not...
  1839.                */
  1840. ***************
  1841. *** 384,394 ****
  1842.                   *p2 = 0;
  1843.               }
  1844.           } else if (search_to) {
  1845. !             if (!(p = header_field(n, "to")) &&
  1846. !                 !(p = header_field(n, "apparently-to")))
  1847.               break;
  1848.           } else if (*search_hdr) {
  1849. !             if (!(p = header_field(n, search_hdr)))
  1850.               break;
  1851.           }
  1852.           if (icase)
  1853. --- 384,393 ----
  1854.                   *p2 = 0;
  1855.               }
  1856.           } else if (search_to) {
  1857. !             if (!(p = header_field(n, "target")))
  1858.               break;
  1859.           } else if (*search_hdr) {
  1860. !             if (!(p = real_header_field(n, search_hdr)))
  1861.               break;
  1862.           }
  1863.           if (icase)
  1864. diff -rc --new-file orig/mush-7.2.5/pmush.c mush-7.2.5/pmush.c
  1865. *** orig/mush-7.2.5/pmush.c    Fri Oct 30 19:56:16 1992
  1866. --- mush-7.2.5/pmush.c    Sat Sep 11 20:42:58 1993
  1867. ***************
  1868. *** 9,17 ****
  1869.       variable POP3_SUPPORT is defined.
  1870.   **************************************************************************/
  1871.   
  1872.   #ifdef POP3_SUPPORT
  1873.   
  1874. - #include "config.h"
  1875.   #include "mush.h"
  1876.   #include "pop.h"
  1877.   
  1878. --- 9,18 ----
  1879.       variable POP3_SUPPORT is defined.
  1880.   **************************************************************************/
  1881.   
  1882. + #include "config.h"
  1883.   #ifdef POP3_SUPPORT
  1884.   
  1885.   #include "mush.h"
  1886.   #include "pop.h"
  1887.   
  1888. ***************
  1889. *** 203,225 ****
  1890.           close(open(mailbox, O_WRONLY | O_CREAT | O_EXCL, 0600));
  1891.       }
  1892.       }
  1893. !     if (!(mfstream = fopen(mailbox, "a"))) {
  1894. !     perror("Error opening mailbox in loadmail");
  1895.       pop_close(postinfo);
  1896.       return;
  1897.       }
  1898.       for (i = 1; i <= msgcount; i++) {    /* Load new messages */
  1899.       msgptr = pop_retrieve(postinfo, i);
  1900. !     dateline = date(msgptr);
  1901. !     fromline = from_line(msgptr);
  1902. !     if (fprintf(mfstream, "\nFrom %s %s\n%s", fromline, dateline, msgptr)
  1903. !         < (strlen(fromline) + strlen(dateline) + strlen(msgptr))) {
  1904. !         fprintf(stderr, "Error writing mailbox file\n");
  1905. !         pop_close(postinfo);
  1906. !         cleanup(-1);
  1907.       }
  1908. -     free(dateline);
  1909. -     free(fromline);
  1910.       free(msgptr);
  1911.       if (pop_delete(postinfo, i)) {
  1912.           fprintf(stderr, "Error deleting message from post office: %s\n",
  1913. --- 204,236 ----
  1914.           close(open(mailbox, O_WRONLY | O_CREAT | O_EXCL, 0600));
  1915.       }
  1916.       }
  1917. !     if ((mfstream = fopen(mailbox, "a")) == NULL) {
  1918. !     perror(mailbox);
  1919.       pop_close(postinfo);
  1920.       return;
  1921.       }
  1922.       for (i = 1; i <= msgcount; i++) {    /* Load new messages */
  1923.       msgptr = pop_retrieve(postinfo, i);
  1924. !     if (msgptr == NULL) break;
  1925. !     if (strncmp(msgptr,"From ",5) == 0) {
  1926. !         if (fputs(msgptr,mfstream) < 0) {
  1927. !         perror(mailbox);
  1928. !         pop_close(postinfo);
  1929. !         cleanup(-1);
  1930. !         }
  1931. !     }
  1932. !     else {
  1933. !       dateline = date(msgptr);
  1934. !       fromline = from_line(msgptr);
  1935. !       if (fprintf(mfstream, "\nFrom %s %s\n%s", fromline, dateline, msgptr)
  1936. !           < (strlen(fromline) + strlen(dateline) + strlen(msgptr))) {
  1937. !           perror(mailbox);
  1938. !           pop_close(postinfo);
  1939. !           cleanup(-1);
  1940. !       }
  1941. !       free(dateline);
  1942. !       free(fromline);
  1943.       }
  1944.       free(msgptr);
  1945.       if (pop_delete(postinfo, i)) {
  1946.           fprintf(stderr, "Error deleting message from post office: %s\n",
  1947. ***************
  1948. *** 227,233 ****
  1949.       }
  1950.       }
  1951.       if (fclose(mfstream) == EOF) {
  1952. !     perror("Error closing mailbox file in loadmail");
  1953.       pop_close(postinfo);
  1954.       return;
  1955.       }
  1956. --- 238,244 ----
  1957.       }
  1958.       }
  1959.       if (fclose(mfstream) == EOF) {
  1960. !     perror(mailbox);
  1961.       pop_close(postinfo);
  1962.       return;
  1963.       }
  1964. diff -rc --new-file orig/mush-7.2.5/pop.c mush-7.2.5/pop.c
  1965. *** orig/mush-7.2.5/pop.c    Fri Oct 30 19:56:14 1992
  1966. --- mush-7.2.5/pop.c    Mon Sep 13 11:12:40 1993
  1967. ***************
  1968. *** 6,11 ****
  1969. --- 6,13 ----
  1970.    * August 13, 1991
  1971.    */
  1972.   
  1973. + #include "config.h"
  1974.   #ifdef POP3_SUPPORT
  1975.   
  1976.   #include <sys/types.h>
  1977. ***************
  1978. *** 47,52 ****
  1979. --- 49,57 ----
  1980.   extern char *
  1981.   strstr( /* char *, char * */ );
  1982.   
  1983. + extern char *
  1984. + index( /* char *, char */);
  1985.   #include <netdb.h>
  1986.   #include <errno.h>
  1987.   #include <stdio.h>
  1988. ***************
  1989. *** 178,212 ****
  1990.   #endif
  1991.       if (!host) {
  1992.       host = getenv("MAILHOST");
  1993. !     if (!host) {
  1994. !         strcpy(pop_error, "Could not determine POP server");
  1995. !         return (0);
  1996. !     }
  1997. !     }
  1998. !     /* Determine the password */
  1999. ! #ifdef KERBEROS
  2000. ! #define DONT_NEED_PASSWORD (! (flags & POP_NO_KERBEROS))
  2001. ! #else
  2002. ! #define DONT_NEED_PASSWORD 0
  2003. ! #endif
  2004. !     /* Modified to return password if possible -- Bart */
  2005. !     if ((!password || !*password) && (!DONT_NEED_PASSWORD)) {
  2006. !     if (!(flags & POP_NO_GETPASS)) {
  2007. !         char *p = getpass("Enter POP password:");
  2008. !         if (p && password)
  2009. !         (void) strcpy(password, p);
  2010. !         password = p;
  2011. !     }
  2012. !     if (!password) {
  2013. !         strcpy(pop_error, "Could not determine POP password");
  2014. !         return (0);
  2015. !     }
  2016.       }
  2017. -     if (password)
  2018. -     flags |= POP_NO_KERBEROS;
  2019. -     else
  2020. -     password = username;
  2021.   
  2022.       sock = socket_connection(host, flags);
  2023.       if (sock == -1)
  2024. --- 183,191 ----
  2025.   #endif
  2026.       if (!host) {
  2027.       host = getenv("MAILHOST");
  2028. !     if (host == NULL || host[0] == '\0')
  2029. !         host = "mailhost";
  2030.       }
  2031.   
  2032.       sock = socket_connection(host, flags);
  2033.       if (sock == -1)
  2034. ***************
  2035. *** 233,250 ****
  2036.           "Username too long; recompile pop.c with larger ERROR_MAX");
  2037.       return (0);
  2038.       }
  2039. !     sprintf(pop_error, "USER %s", username);
  2040.   
  2041.       if (sendline(server, pop_error) || getok(server)) {
  2042.       return (0);
  2043.       }
  2044.       if (strlen(password) > ERROR_MAX - 6) {
  2045.       pop_close(server);
  2046.       strcpy(pop_error,
  2047.           "Password too long; recompile pop.c with larger ERROR_MAX");
  2048.       return (0);
  2049.       }
  2050. !     sprintf(pop_error, "PASS %s", password);
  2051.   
  2052.       if (sendline(server, pop_error) || getok(server)) {
  2053.       return (0);
  2054. --- 212,255 ----
  2055.           "Username too long; recompile pop.c with larger ERROR_MAX");
  2056.       return (0);
  2057.       }
  2058. !     sprintf(pop_error, "USER \"%s\"", username);
  2059.   
  2060.       if (sendline(server, pop_error) || getok(server)) {
  2061.       return (0);
  2062.       }
  2063. +     /* Determine the password */
  2064. + #ifdef KERBEROS
  2065. + #define DONT_NEED_PASSWORD (! (flags & POP_NO_KERBEROS))
  2066. + #else
  2067. + #define DONT_NEED_PASSWORD 0
  2068. + #endif
  2069. +     /* Modified to return password if possible -- Bart */
  2070. +     if ((!password || !*password) && (!DONT_NEED_PASSWORD)) {
  2071. +     if (!(flags & POP_NO_GETPASS)) {
  2072. +         char *p = getpass("Password: ");
  2073. +         if (p && password)
  2074. +         (void) strcpy(password, p);
  2075. +         password = p;
  2076. +     }
  2077. +     if (!password) {
  2078. +         strcpy(pop_error, "Could not determine POP password");
  2079. +         return (0);
  2080. +     }
  2081. +     }
  2082. +     if (password)
  2083. +     flags |= POP_NO_KERBEROS;
  2084. +     else
  2085. +     password = username;
  2086.       if (strlen(password) > ERROR_MAX - 6) {
  2087.       pop_close(server);
  2088.       strcpy(pop_error,
  2089.           "Password too long; recompile pop.c with larger ERROR_MAX");
  2090.       return (0);
  2091.       }
  2092. !     sprintf(pop_error, "PASS \"%s\"", password);
  2093.   
  2094.       if (sendline(server, pop_error) || getok(server)) {
  2095.       return (0);
  2096. ***************
  2097. *** 882,888 ****
  2098.       int ret;
  2099.   
  2100.       cp = buf;
  2101. !     while ((ret = write(fd, cp, nbytes)) > 0) {
  2102.       cp += ret;
  2103.       nbytes -= ret;
  2104.       }
  2105. --- 887,893 ----
  2106.       int ret;
  2107.   
  2108.       cp = buf;
  2109. !     while (nbytes > 0 && (ret = write(fd, cp, nbytes)) > 0) {
  2110.       cp += ret;
  2111.       nbytes -= ret;
  2112.       }
  2113. ***************
  2114. *** 969,985 ****
  2115.    *     Changes made to the maildrop since the session was started (or
  2116.    *     since the last pop_reset) may be lost.
  2117.    */
  2118.   void 
  2119.   pop_close(server)
  2120.   PopServer server;
  2121.   {
  2122. -     sendline(server, "RSET");
  2123. -     sendline(server, "QUIT");
  2124.   
  2125. !     close(server->file);
  2126. !     free((char *) server);
  2127.   
  2128. !     return;
  2129.   }
  2130.   
  2131.   #endif /* POP3_SUPPORT */
  2132. --- 974,996 ----
  2133.    *     Changes made to the maildrop since the session was started (or
  2134.    *     since the last pop_reset) may be lost.
  2135.    */
  2136. + unsigned pop_closing = 0;
  2137.   void 
  2138.   pop_close(server)
  2139.   PopServer server;
  2140.   {
  2141.   
  2142. !     if (pop_closing == 0) {
  2143. !     pop_closing = 1;
  2144. !     sendline(server, "RSET");
  2145. !     sendline(server, "QUIT");
  2146.   
  2147. !     close(server->file);
  2148. !     free((char *) server);
  2149. !     }
  2150.   }
  2151.   
  2152.   #endif /* POP3_SUPPORT */
  2153. diff -rc --new-file orig/mush-7.2.5/signals.c mush-7.2.5/signals.c
  2154. *** orig/mush-7.2.5/signals.c    Fri Oct 30 19:55:42 1992
  2155. --- mush-7.2.5/signals.c    Sat Oct 16 19:57:00 1993
  2156. ***************
  2157. *** 8,13 ****
  2158. --- 8,14 ----
  2159.   
  2160.   static int was_stopped;
  2161.   
  2162. + #ifndef __linux__
  2163.   #ifndef SYSV
  2164.   extern char *sys_siglist[];
  2165.   #else
  2166. ***************
  2167. *** 34,40 ****
  2168.   /* SIGCLD */    "death of a child",
  2169.   /* SIGPWR */    "power-fail restart"
  2170.   };
  2171. ! #endif /* SYSV */
  2172.   
  2173.   SIGRET
  2174.   intrpt(sig)
  2175. --- 35,42 ----
  2176.   /* SIGCLD */    "death of a child",
  2177.   /* SIGPWR */    "power-fail restart"
  2178.   };
  2179. ! #endif /* !SYSV */
  2180. ! #endif /* !__linux__ */
  2181.   
  2182.   SIGRET
  2183.   intrpt(sig)
  2184. ***************
  2185. *** 425,431 ****
  2186.       if (last_check < 0)
  2187.       last_check = time((long *)0);
  2188.       
  2189. !     if (istool || time((long *)0) - last_check > time_out) {
  2190.       popchkmail();
  2191.       last_check = time((long *)0);
  2192.       }
  2193. --- 427,434 ----
  2194.       if (last_check < 0)
  2195.       last_check = time((long *)0);
  2196.       
  2197. !     if (isoff(glob_flags,DONT_CHECK)
  2198. !         && (istool || time((long *)0) - last_check > time_out)) {
  2199.       popchkmail();
  2200.       last_check = time((long *)0);
  2201.       }
  2202. diff -rc --new-file orig/mush-7.2.5/sort.c mush-7.2.5/sort.c
  2203. *** orig/mush-7.2.5/sort.c    Mon Oct 22 03:25:03 1990
  2204. --- mush-7.2.5/sort.c    Wed Oct 27 18:04:05 1993
  2205. ***************
  2206. *** 40,45 ****
  2207. --- 40,46 ----
  2208.           case 'l': /* sort by length in bytes */
  2209.           case 'S': /* sort by message status */
  2210.           case 'p': /* sort by message priority */
  2211. +         case 't': /* sort by addressee */
  2212.               /* skip consecutive repeats of the same flag */
  2213.               if (depth < 1 || subsort[depth-1] != argv[0][n])
  2214.               subsort[depth++] = argv[0][n];
  2215. ***************
  2216. *** 164,175 ****
  2217.   
  2218.   author_cmp(msg1, msg2)
  2219.   register struct msg *msg1, *msg2;
  2220.   {
  2221.       char buf1[HDRSIZ], buf2[HDRSIZ];
  2222.       int retval;
  2223.   
  2224. !     (void) reply_to(msg1 - msg, 0, buf1); /* "0" for "author only" */
  2225. !     (void) reply_to(msg2 - msg, 0, buf2);
  2226.       Debug("author: msg %d: %s, msg %d: %s\n", msg1-msg, buf1, msg2-msg, buf2);
  2227.       if (ignore_case)
  2228.       retval = lcase_strncmp(buf1, buf2, -1) * order;
  2229. --- 165,177 ----
  2230.   
  2231.   author_cmp(msg1, msg2)
  2232.   register struct msg *msg1, *msg2;
  2233. + #if 1
  2234.   {
  2235.       char buf1[HDRSIZ], buf2[HDRSIZ];
  2236.       int retval;
  2237.   
  2238. !     (void) author_to(msg1 - msg, buf1);
  2239. !     (void) author_to(msg2 - msg, buf2);
  2240.       Debug("author: msg %d: %s, msg %d: %s\n", msg1-msg, buf1, msg2-msg, buf2);
  2241.       if (ignore_case)
  2242.       retval = lcase_strncmp(buf1, buf2, -1) * order;
  2243. ***************
  2244. *** 177,182 ****
  2245. --- 179,204 ----
  2246.       retval = strcmp(buf1, buf2) * order;
  2247.       return retval ? retval : msg_cmp(msg1, msg2);
  2248.   }
  2249. + #else
  2250. + {
  2251. +     char buf1[HDRSIZ], buf2[HDRSIZ], *p;
  2252. +     int retval;
  2253. +     if (!(p = header_field(msg1 - msg, "source")))
  2254. +     p = "";
  2255. +     (void) strcpy(buf1, p);
  2256. +     if (!(p = header_field(msg2 - msg, "source")))
  2257. +     p = "";
  2258. +     (void) strcpy(buf2, p);
  2259. +     Debug("authors: (%d): \"%s\" (%d): \"%s\"\n",
  2260. +     msg1-msg, buf1, msg2-msg, buf2);
  2261. +     if (ignore_case)
  2262. +     retval = lcase_strncmp(buf1, buf2, -1) * order;
  2263. +     else
  2264. +     retval = strcmp(buf1, buf2) * order;
  2265. +     return retval ? retval : msg_cmp(msg1, msg2);
  2266. + }
  2267. + #endif
  2268.   
  2269.   /* compare messages according to size (length) */
  2270.   size_cmp(msg1, msg2)
  2271. ***************
  2272. *** 249,254 ****
  2273. --- 271,300 ----
  2274.       return retval ? retval : msg_cmp(msg1, msg2);
  2275.   }
  2276.   
  2277. + /*
  2278. +  * compare addressee strings from two messages.
  2279. +  */
  2280. + addressee_cmp(msg1, msg2)
  2281. + register struct msg *msg1, *msg2;
  2282. + {
  2283. +     char buf1[HDRSIZ], buf2[HDRSIZ], *p;
  2284. +     int retval;
  2285. +     if (!(p = header_field(msg1 - msg, "target")))
  2286. +     p = "";
  2287. +     (void) strcpy(buf1, p);
  2288. +     if (!(p = header_field(msg2 - msg, "target")))
  2289. +     p = "";
  2290. +     (void) strcpy(buf2, p);
  2291. +     Debug("addressees: (%d): \"%s\" (%d): \"%s\"\n",
  2292. +     msg1-msg, buf1, msg2-msg, buf2);
  2293. +     if (ignore_case)
  2294. +     retval = lcase_strncmp(buf1, buf2, -1) * order;
  2295. +     else
  2296. +     retval = strcmp(buf1, buf2) * order;
  2297. +     return retval ? retval : msg_cmp(msg1, msg2);
  2298. + }
  2299.   date_cmp(msg1, msg2)
  2300.   register struct msg *msg1, *msg2;
  2301.   {
  2302. ***************
  2303. *** 306,311 ****
  2304. --- 352,358 ----
  2305.       when 'R': retval = subj_with_re(msg1, msg2);
  2306.       when 'l': retval = size_cmp(msg1, msg2); /* length compare */
  2307.       when 'p': retval = pri_cmp(msg1, msg2);
  2308. +     when 't': retval = addressee_cmp(msg1, msg2);
  2309.       otherwise: retval = status_cmp(msg1, msg2);
  2310.       }
  2311.       depth = sv_depth;
  2312. diff -rc --new-file orig/mush-7.2.5/xcreat.c mush-7.2.5/xcreat.c
  2313. *** orig/mush-7.2.5/xcreat.c    Fri Oct 30 19:56:16 1992
  2314. --- mush-7.2.5/xcreat.c    Mon Sep 13 12:17:18 1993
  2315. ***************
  2316. *** 157,171 ****
  2317.       int j = -2, i;
  2318.   
  2319.       q = rindex(name, '/');
  2320. !     if (q)
  2321. !     i = q - name;
  2322. !     else {
  2323. !     i = 0;    /* Creating in the current directory */
  2324. !     }
  2325.       p = strncpy(buf, name, i);
  2326.       if (unique(p, p + i, mode))
  2327.       j = myrename(p, name);    /* try and rename it, fails if nonexclusive */
  2328. -     free(p);
  2329.       return j;
  2330.   }
  2331.   
  2332. --- 157,166 ----
  2333.       int j = -2, i;
  2334.   
  2335.       q = rindex(name, '/');
  2336. !     i = (q == 0) ? 0 : q-name+1;
  2337.       p = strncpy(buf, name, i);
  2338.       if (unique(p, p + i, mode))
  2339.       j = myrename(p, name);    /* try and rename it, fails if nonexclusive */
  2340.       return j;
  2341.   }
  2342.   
  2343.